Class: Plumb::Codec::JSON

Inherits:
Plumb::Codec show all
Defined in:
lib/plumb/codec.rb

Overview

A base codec for JSON-like targets: the scalars native to JSON pass through (structured containers are handled structurally by the rewrite; the bare Hash/Array tops cover untyped ones), and Dates/Times/URIs map to their standard string forms. Subclass it and register encoders:

class MyCodec < Plumb::Codec::JSON
encoder MoneyEncoder
end

A subclass encoder for an equivalent type (eg. its own Date encoder) takes precedence over the built-in one.

Constant Summary

Constants inherited from Plumb::Codec

FLOAT_EXPR, FileURIEncoder, HTTPURIEncoder, NoEntryError, TIME_EXPR, URI_EXPR

Method Summary

Methods inherited from Plumb::Codec

>>, at_path, call, #decode, #encode, encoder, encoder_for, for, #freeze, inherited, #initialize, inspect, #inspect, #key?, noop, noop?, noop_value?, #register, to_composable, to_plumb_type, |

Constructor Details

This class inherits a constructor from Plumb::Codec