def load_lib
path = File.join(File.dirname(__FILE__), 'lib')
failures = []
Dir.glob("#{path}/**/*.rb").each { |file|
puts "loading: #{file} ... "
}
end
There's the script. When I put each line in individually, the load_lib
function is available and works fine. But when I paste it into irb in one big chunk (Ubuntu terminal, Sh Ctrl C) it freaks out at the Dir.glob(...
line and shows this:
Display all 931 possibilities? (y or n)
!
!=
!~
<=>
.... [dozens of lines in this vein]
and then the method isn't created at all.
Here's what happens (success) when I paste it in one line at a time:
>> def load_lib
>> path = File.join(File.dirname(__FILE__), 'lib')
>> failures = []
>> Dir.glob("#{path}/**/*.rb").each { |file|
?> puts file
>> }
>> end
=> nil
>> load_lib
./lib/alpha_processor.rb
./lib/development_mail_interceptor.rb
./lib/service_processors/beta_processor.rb
Is there something about the []
or {}
that irb doesn't like when they are pasted in?
That's because of TAB characters you have in your source file. Indent with spaces. :-)
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