On Monday, May 26, 2014 8:32:00 PM UTC-7, Derek Sivers wrote:
>
> Hello fellow Sequel fans. Using the newest Sequel 4.10.0, I'm getting a
> very unlikely error when Sequel tries to convert an incoming BigDecimal to
> a string.
>
> The error is "ArgumentError: wrong number of arguments (1 for 0)"
>
> FILE:
> /usr/lib/ruby/gems/2.1.0/gems/sequel-4.10.0/lib/sequel/dataset/sql.rb
>
> FUNCTION:
> def literal_big_decimal(v)
> d = v.to_s("F") # <-- there
>
> Thing is, it should work, according to
> http://www.ruby-doc.org/stdlib-2.1.1/libdoc/bigdecimal/rdoc/BigDecimal.html#method-i-to_s
>
> I can't find any reason why it's giving a "ArgumentError: wrong number of
> arguments (1 for 0)" error.
>
> When I comment out the ("F"), it works without error.
>
> When I inspect the incoming "v" variable:
> v.class is BigDecimal
> v.inspect is #<BigDecimal:2df2da0,'0.1111E2',18(18)>
> v to_s is 11.11
>
> Any suggestions?
>
Only thing I can think of is some library you are using is overriding
BigDecimal#to_s. Can you try:
BigDecimal.instance_method(:to_s).source_location
Or if you want to monkey patch the literal_big_decimal method:
v.method(:to_s).source_location
If it gives you nil, it means the method was defined in C, which probably
means the stdlib version (unlikely that a C extension would override it,
but still possible).
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.