[#74190] [Ruby trunk Feature#12134] Comparison between `true` and `false` — duerst@...
Issue #12134 has been updated by Martin D端rst.
3 messages
2016/03/07
[#74269] Type systems for Ruby — Rob Blanco <ml@...>
Dear ruby-core,
5 messages
2016/03/10
[#74395] [Ruby trunk Feature#12142] Hash tables with open addressing — shyouhei@...
Issue #12142 has been updated by Shyouhei Urabe.
3 messages
2016/03/17
[ruby-core:74330] [Ruby trunk Bug#12105][Third Party's Issue] JSON.pretty_generate throws a TypeError when there is a BigDecimal object as a value
From:
shyouhei@...
Date:
2016-03-15 06:03:47 UTC
List:
ruby-core #74330
Issue #12105 has been updated by Shyouhei Urabe.
Status changed from Open to Third Party's Issue
It works for me. Can you narrow the condition to reproduce yours?
~~~
zsh % rbenv exec irb
irb(main):001:0> RUBY_VERSION
=> "2.3.0"
irb(main):002:0> require 'json'
=> true
irb(main):003:0> require 'bigdecimal'
=> true
irb(main):004:0> hash = {"x" => BigDecimal('50.0')}
=> {"x"=>#<BigDecimal:7fa303986428,'0.5E2',9(18)>}
irb(main):005:0> JSON.pretty_generate(hash)
=> "{\n \"x\": \"0.5E2\"\n}"
irb(main):006:0>
~~~
----------------------------------------
Bug #12105: JSON.pretty_generate throws a TypeError when there is a BigDecimal object as a value
https://bugs.ruby-lang.org/issues/12105#change-57454
* Author: Adnan Abdulally
* Status: Third Party's Issue
* Priority: Normal
* Assignee:
* ruby -v: 2.3.0
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
As the title states, JSON.pretty_generate throws a TypeError when there is a BigDecimal object as a value. This used to work in ruby 2.0 before upgrading in development. I havent tested to see how far back in ruby versions the error goes.
Example console log of how to replicate:
`
[17] pry(main)> hash = {"x" => BigDecimal('50.0')}
=> {"x"=>#<BigDecimal:1befe50,'0.5E2',9(18)>}
[18] pry(main)> JSON.pretty_generate(hash)
TypeError: wrong argument type Float (expected String)
from /home/adnan/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/core_ext/object/json.rb:34:in `to_json'
`
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>