Reputation: 147
I'm using a short bash script to help me test an implementation of linked lists in ruby for class. I know about rspec and unit testing, and I'm certain they're better options for what I'm trying to do, but I was able to figure out this command
echo "require './nodes'" | irb
The output afterwards is
Switch to inspect mode.
require './nodes'
true
Technically a success, but the irb process ends there. So I tried
echo "require './nodes'" | irb --noinspect
Which gave me
Switch to non inspect mode.
require './nodes'
true
And it again exits the irb process.
I'm just trying to make my workflow a little bit more convenient, as I like to use irb to test my files by poking around at them and seeing what happens.
Upvotes: 0
Views: 1182
Reputation: 14913
Create a simple script, the code below will land you into the irb
shell with the 'nodes' gem included. If you are using Ruby 1.8.x then you'll need to add require 'rubygems'
before requiring nodes gem
#!/path/to/ruby -w
require 'irb'
require 'nodes'
IRB.start
Upvotes: 2