我正在尝试使用来自不同文件的类.
something.rb
class Something
def initialize
end
def getText
'Some example text'
end
end
Run Code Online (Sandbox Code Playgroud)
another.rb
class Another
end
somethingVar = Something.new
puts somethingVar.getText
Run Code Online (Sandbox Code Playgroud)
这给了我错误
/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/chris/RubymineProjects/untitled1/another.rb
/home/chris/RubymineProjects/untitled1/another.rb:4:in `<top (required)>': uninitialized constant Something (NameError)
from -e:1:in `load'
from -e:1:in `<main>'
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
| 归档时间: |
|
| 查看次数: |
83 次 |
| 最近记录: |