Class: BSON::OrderedHash

Inherits:
Object
  • Object
show all
Defined in:
lib/rackjson/extensions/BSON/ordered_hash.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject



2
3
4
# File 'lib/rackjson/extensions/BSON/ordered_hash.rb', line 2

def to_h
  inject({}) { |acc, element| k,v = element; acc[k] = (if v.class == BSON::OrderedHash then v.to_h else v end); acc }
end

#to_jsonObject



6
7
8
# File 'lib/rackjson/extensions/BSON/ordered_hash.rb', line 6

def to_json
  to_h.to_json
end