Class: MagicPipe::Codecs::Json
- Defined in:
- lib/magic_pipe/codecs/json.rb
Constant Summary collapse
- TYPE =
"application/json"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, #inner_object, #type
Constructor Details
This class inherits a constructor from MagicPipe::Codecs::Base
Instance Method Details
#encode ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/magic_pipe/codecs/json.rb', line 8 def encode if o.respond_to?(:to_json) o.to_json elsif o.respond_to?(:as_json) json_dump(o.as_json) else json_dump(o) end end |