Module: MaimaiNet::CoreExt::JSONSupport
- Defined in:
- lib/maimai_net/core_ext.rb
Overview
adds JSON conversion support through ‘#to_h` conversion.
Instance Method Summary collapse
Instance Method Details
#as_json(options = nil) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/maimai_net/core_ext.rb', line 19 def as_json( = nil) to_h.transform_values do |val| val.respond_to?(:as_json) ? val.as_json() : val end end |
#to_json(options = nil) ⇒ Object
26 27 28 |
# File 'lib/maimai_net/core_ext.rb', line 26 def to_json( = nil) as_json.to_json() end |