Relativity gem bigdecimal

having trouble with relativity gem im using it for the first time when i
try the example code it ran to this error
this is my test.rb file

require 'relativity'
opens_at = DayTime.new(9) #=> 09:00:00
closes_at = DayTime.new(12,30) #=> 12:30:00
/home/joe/.rvm/gems/ruby-1.9.2-p290/gems/relativity-0.0.8/lib/relativity/day_time/new.rb:24:in
`BigDecimal': can't convert Fixnum into String (TypeError)
  from
/home/joe/.rvm/gems/ruby-1.9.2-p290/gems/relativity-0.0.8/lib/relativity/day_time/new.rb:24:in
`initialize'
  from /home/joe/Aptana Studio 3
Workspace/jquery/javascript/test.rb:2:in `new'
  from /home/joe/Aptana Studio 3
Workspace/jquery/javascript/test.rb:2:in `'

thank in advance

This happens to be a bug in the relativity gem. I did a little
debugging (this bug was such a huge pain) and found that the problem has
to do with Ruby 1.9.2.

In Ruby 1.9.2, BigDecimal raises an error when you pass to it an Integer
(including Fixnum and Bignum). Relativity contains the following code:
BigDecimal.new(nn) where nn is a Fixnum. A workaround for this is
to interpolate nn in a string as so: BigDecimal.new("#{nn}").

In the mean time, I would just use Ruby 1.9.3 (new features and it works
:D) as BigDecimal works according to the documentation.

Also, don’t worry about filing a bug report with the developer. I’m
going to fix the code and do a pull request on GitHub.

Bryan D. wrote in post #1049553:

This happens to be a bug in the relativity gem. I did a little
debugging (this bug was such a huge pain) and found that the problem has
to do with Ruby 1.9.2.

In Ruby 1.9.2, BigDecimal raises an error when you pass to it an Integer
(including Fixnum and Bignum). Relativity contains the following code:
BigDecimal.new(nn) where nn is a Fixnum. A workaround for this is
to interpolate nn in a string as so: BigDecimal.new("#{nn}").

In the mean time, I would just use Ruby 1.9.3 (new features and it works
:D) as BigDecimal works according to the documentation.

Also, don’t worry about filing a bug report with the developer. I’m
going to fix the code and do a pull request on GitHub.

im using ruby 1.9.2 so i need to upgrade my ruby version to 1.9.3 thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs