I'm following a book called the "Beginner's Guide to Ruby" and I'm afraid I'm not sure what 'requiring a library' means.
In my applications root directory I have a file called wordplay.rb and a I know how to start irb in Terminal. But I don't know how to
'use irb and require in the wordplay library'
From the directory wordplay.rb
is in, run irb
and enter:
irb(main):001:0> require './wordplay'
Hopefully it will come back saying:
=> true
which means that the file was loaded successfully.
If it doesn't say 'true', it means that you still have to install a Ruby Gem which provides the library. To install a gem, you have to type this in your shell:
gem install wordplay # or whatever your gem is called
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With