hashie/hashie

Can't call to_hash with nested `Sequel::Postgres::JSONBHash`

Closed this issue · 3 comments

See the code below:

> Hashie::Mash.new(blah: Sequel::Postgres::JSONBHash.new({})).to_hash
ArgumentError: wrong number of arguments (given 1, expected 0)
from /home/braulio/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/delegate.rb:343:in `to_hash

A workaround is to convert Sequel::Postgres::JSONBHash with to_hash before using it inside Hashie::Mash

Possibly expected as JSONBHash is a delegate class of Hash, not a subclass of hash. Unless hashie is expected to convert delegate classes of Hash, this is unlikely to be a bug in hashie.

I agree with Jeremy here. Since that class is not a Hash, it's unexpected input to Mash's constructor.