def load_lib
path = File.join(File.dirname(__FILE__), 'lib')
failures = []
Dir.glob("#{path}/**/*.rb").each { |file|
puts "loading: #{file} ... "
}
end
Run Code Online (Sandbox Code Playgroud)
有脚本.当我单独放入每一行时,该load_lib功能可用并且工作正常.但是当我将它粘贴到irb中的一个大块(Ubuntu终端,Sh Ctrl C)时,它会突然出现Dir.glob(...在线上并显示:
Display all 931 possibilities? (y or n)
!
!=
!~
<=>
.... [dozens of lines in this vein]
Run Code Online (Sandbox Code Playgroud)
然后根本不创建该方法.
以下是我一次将其粘贴到一行时发生的情况(成功):
>> def load_lib
>> path = File.join(File.dirname(__FILE__), 'lib')
>> failures = []
>> Dir.glob("#{path}/**/*.rb").each { |file|
?> puts file
>> }
>> end
=> nil
>> load_lib
./lib/alpha_processor.rb
./lib/development_mail_interceptor.rb
./lib/service_processors/beta_processor.rb
Run Code Online (Sandbox Code Playgroud)
是否有一些关于[]或{}当他们被粘贴该IRB不喜欢?
Ser*_*sev 27
这是因为你的源文件中有TAB字符.缩进空格.:-)
| 归档时间: |
|
| 查看次数: |
3273 次 |
| 最近记录: |