Hello,
I am quite new at Ruby (we use it for test automation in conjunction
with Cucumber, where it works great!) but as a stand-alone, I'm finding
myself more productive with Python. Maybe that's just me.
I have to confess I do not know what the issue is. When I try to run the
attached script (note: this example is copied *EXACTLY* from Ruby
Cookbook) I am given the following error at Windows cmdline:
E:\Sounds\Digital>ruby Froop.rb
Froop.rb:6:in `match': undefined method `find' for Froop:Module
(NoMethodError)
from Froop.rb:12:in `<main>'
Note that the Froop.rb is in same directory from where I am attempting
to run it. Ruby doesn't seem to recognize it's own require statement:
require 'find'
on the first line of the file, which is positively baffling.
Note, that when I try to only put my function in the file and call Froop
from the command line (how I originally tried to do it), that's a lost
cause too:
E:\Sounds\Digital>irb
irb(main):001:0> require 'Froop'
LoadError: no such file to load -- Froop
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from (irb):1
from C:/Ruby192/bin/irb:12:in `<main>'
irb(main):002:0> Froop.match("./") { |p| ext = p[-4...p.size]; ext &&
ext.downcase == "mp3" }
NameError: uninitialized constant Object::Froop
from (irb):2
from C:/Ruby192/bin/irb:12:in `<main>'
irb(main):003:0>
Seriously what gives? I'm ready to put Ruby in the Bin and switch to
Python, but my heart won't let me...yet.
Attachments:
http://www.ruby-forum.com/attachment/5260/Froop.rb
···
--
Posted via http://www.ruby-forum.com/.