意外的'>'在Ruby 1.8.7上使用money gem

时间:2014-03-26 12:41:57

标签: ruby currency

我正在使用ruby 1.8.7,rails 2.3.17

宝石'钱'

Gemfile.lock使用money(6.0.1)

但是在乘客时,它显示错误

/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:153: syntax error, unexpected '>'
        fn = -> { @rates[rate_key_for(from, to)] = rate }
               ^
/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:153: odd number list for Hash
/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:179: syntax error, unexpected '>'
        fn = -> { @rates[rate_key_for(from, to)] }
               ^
/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:179: odd number list for Hash
/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:212: syntax error, unexpected '>'
        fn = -> {
               ^
/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:220: odd number list for Hash
/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:222: syntax error, unexpected kUNLESS, expecting '}'
          unless file.nil?
                ^
/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:225: syntax error, unexpected '}', expecting kEND
/home/debadattap/.rvm/gems/ruby-1.8.7-p374@syr/gems/money-6.0.1/lib/money/bank/variable_exchange.rb:257: syntax error, unexpected '>'
        fn = -> {
               ^

感谢任何帮助。

由于

1 个答案:

答案 0 :(得分:3)

Money gem的那个版本使用的是Ruby 1.9+语法,所以不能使用你正在使用的Ruby 1.8.7。 gem的更新日志提到了6.0.0中的1.8.7支持,因此您可以尝试使用该版本的gem。

https://github.com/RubyMoney/money/blob/master/CHANGELOG.md