Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJess Claussen
6,078 PointsHow would you retrieve a hash and put it into ruby?
If you wanted to use the item hash from the create_a_hash.rb and use it in irb?
4 Answers
krilnon
1,458 PointsOkay, try irb -r /home/treehouse/workspace/create_a_hash.rb
That worked for me in a workspace. My create_a_hash.rb was just in the default folder for a new workspace. If you've put yours inside another folder, then you'd have to add that folder name before the file name.
krilnon
1,458 Pointsirb -r create_a_hash.rb
If you had hash = Hash.new
in create_a_hash.rb, then you could run IRB with the line above, then you'd have access to hash
from within your IRB session.
Jess Claussen
6,078 PointsThanks for the reply. I get a can not open file error trying it this way.
krilnon
1,458 PointsHow are you using irb
? Online? Locally on your computer? In a Treehouse workspace?
Jess Claussen
6,078 PointsIn a Treehouse workspace.
Jess Claussen
6,078 PointsAfter closing the window irb -r ./create_a_hash.rb works. Thanks for the help.