class BSON::OrderedHash
Public Instance Methods
to_h()
click to toggle source
Convert a BSON
result to a Hash
# File lib/ghtorrent/bson_orderedhash.rb, line 7 def to_h inject({}) do |acc, element| k, v = element; acc[k] = if v.class == Array then v.map{|x| if x.class == BSON::OrderedHash then x.to_h else x end} elsif v.class == BSON::OrderedHash then v.to_h else v end; acc end end
to_json()
click to toggle source
# File lib/ghtorrent/bson_orderedhash.rb, line 21 def to_json to_h.to_json end