A
Adam Cohen
So I am fairly new to ruby and I'm using the language to work on a new
project. The details of the project however are not relevant to this
post, but some of the code is.
Long story short, I have a big case statement that will execute
different methods depending on input (its a command line system im
building for sometihng) and the case will call my method version_info?
by using the call self.version_info? however I then get this error
instead of the proper output.
secretproject.rb:51: undefined method `version_info?' for main:Object
(NoMethodError)
my method looks like this
def version_info?
puts 'secretproject runtime version ' + version.to_s
puts 'written and maintained: Adam Ross Cohen'
puts 'math genius: Evan Penn'
puts 'thanks for playing.'
end
I dont understand why the object doesn't contain the method, however I
have a hunch... my ruby file isn't a class, its just a file with methods
in it, however as I understand it I should still be able to call the
method because it makes the object when it runs the file.
please let me know if you can correct my (most likely foolish) mistake.
thanks in advance, A. Ross Cohen
project. The details of the project however are not relevant to this
post, but some of the code is.
Long story short, I have a big case statement that will execute
different methods depending on input (its a command line system im
building for sometihng) and the case will call my method version_info?
by using the call self.version_info? however I then get this error
instead of the proper output.
secretproject.rb:51: undefined method `version_info?' for main:Object
(NoMethodError)
my method looks like this
def version_info?
puts 'secretproject runtime version ' + version.to_s
puts 'written and maintained: Adam Ross Cohen'
puts 'math genius: Evan Penn'
puts 'thanks for playing.'
end
I dont understand why the object doesn't contain the method, however I
have a hunch... my ruby file isn't a class, its just a file with methods
in it, however as I understand it I should still be able to call the
method because it makes the object when it runs the file.
please let me know if you can correct my (most likely foolish) mistake.
thanks in advance, A. Ross Cohen