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, TIME_EXPR, URI_EXPR

Instance Attribute Summary

Attributes inherited from Plumb::Codec

#encoders, #noop_types

Method Summary

Methods inherited from Plumb::Codec

&, >>, #>>, #at_path, call, #call, encoder, #encoder_for, encoders, for, #for, #initialize, instance, noop, #noop?, noop_types, #noop_value?, to_composable, to_plumb_type, #to_plumb_type, |, #|

Methods included from Plumb::Composable

#&, #/, #>>, #[], #absorb_input, #absorb_output, #accepted_type, #as_node, #build, #check, #children, #defer, #fusable_step?, #fuse_with, #generate, #idempotent?, included, #input_type, #invalid, #invoke, #match, #metadata, #not, #output_type, #pipeline, #policy, resolve_operand, #static, #subtype_identity, #to_json_schema, #to_mermaid, #to_plumb_type, #to_s, #transform, #value, #value_preserving?, #where, #with, wrap, #|

Methods included from Plumb::Callable

#call, #parse, #resolve

Constructor Details

This class inherits a constructor from Plumb::Codec