所以我正在研究Ruby Koans,我遇到了一个我认为特定于ruby1.9.x的问题.
def test_calling_global_methods_without_parentheses
result = my_global_method 2, 3
assert_equal 5, result
end
Run Code Online (Sandbox Code Playgroud)
我明白了:
james@tristan:~/code/ruby_projects/ruby_koans$ rake
(in /home/james/code/ruby_projects/ruby_koans)
cd koans
/home/james/.rvm/rubies/ruby-1.9.2-p180/bin/ruby path_to_enlightenment.rb
/home/james/code/ruby_projects/ruby_koans/koans/about_methods.rb:21:in `eval': (eval):1: syntax error, unexpected tINTEGER, expecting keyword_do or '{' or '(' (SyntaxError)
assert_equal 5, my_global_method 2, 3
^
from /home/james/code/ruby_projects/ruby_koans/koans/about_methods.rb:21:in `test_sometimes_missing_parentheses_are_ambiguous'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:377:in `meditate'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:449:in `block in walk'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:460:in `block (3 levels) in each_step'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:458:in `each'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:458:in `block (2 levels) in each_step'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:457:in `each'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:457:in `each_with_index'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:457:in `block in each_step'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:455:in `catch'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:455:in `each_step'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:448:in `walk'
from /home/james/code/ruby_projects/ruby_koans/koans/edgecase.rb:470:in `block in <top (required)>'
rake aborted!
Command failed with status (1): [/home/james/.rvm/rubies/ruby-1.9.2-p180/bi...]
/home/james/code/ruby_projects/ruby_koans/Rakefile:86:in `block in <top (required)>'
(See full trace by running task with --trace)
james@tristan:~/code/ruby_projects/ruby_koans$
Run Code Online (Sandbox Code Playgroud)
我看了几个不同的GitHub存储库,声称最近完成了Koans(过去两个月),我只看到了我使用的答案(第一个代码片段).那么,它是我的代码,我的Ruby安装或其他什么东西?
| 归档时间: |
|
| 查看次数: |
948 次 |
| 最近记录: |