6

Ruby- why won't "if __FILE__ == $0" work?

view full story
linux-howto

http://ubuntuforums.org – I'm playing around with Ruby for the first time & I just did a tutorial. I copied the script shown below. I saved it as a .rb file, then I called it in terminal. It pukes at Code: if __FILE__ == $0 When I remove that line (and the "end") the script runs fine. Can anyone tell me why the line isn't working? Here's the script. The lines I have to delete in order for it to run are shown in bold. Code: #!/usr/bin/env ruby class MegaGreeter     attr_accessor :names     #Create the object     def initialize(names = "World") (Hardware)