我是Ruby新手。我的示例代碼是給我這個例外:嘗試調用Ruby中的方法時出現異常
C:/Users/abc/RubymineProjects/Sample/hello.rb:5:in `<class:Hello>': undefined method `first_method' for Hello:Class (NoMethodError)
from C:/Users/abc/RubymineProjects/Sample/hello.rb:1:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
過程與退出代碼完成1個
我的代碼是:
class Hello
def first_method
puts "Hello World"
end
first_method()
end
我使用的RubyMine 4.5.4。