Ruby를 처음 사용했습니다. 내 샘플 코드는 나에게이 예외를주고있다 : 1 개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>'
프로세스 : 나는 RubyMine 4.5.4을 사용하고
class Hello
def first_method
puts "Hello World"
end
first_method()
end
합니다.
class Hello
def first_method
puts "Hello World"
end
end
Hello.new.first_method