我在 RubyMine 中有这两个类:
book.rb
:
class Book
def initialize(name,author)
end
end
test.rb
:
require 'book'
class teste
harry_potter = Book.new("Harry Potter", "JK")
end
当我运行时test.rb
,我收到此错误:
C:/Users/DESKTOP/RubymineProjects/learning/test.rb:3:in `<class:Test>': uninitialized constant Test::Book (NameError)
from C:/Users/DESKTOP/RubymineProjects/learning/test.rb:1:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'