Class: Plumb::Codec::Forms
- Inherits:
-
Plumb::Codec
- Object
- Plumb::Codec
- Plumb::Codec::Forms
- Defined in:
- lib/plumb/codec.rb
Overview
A base codec for string-based formats — HTML forms, query strings, CSV cells — where EVERY value arrives as a string. Unlike Codec::JSON there are almost no native scalars: strings pass through, untyped containers recurse structurally (Rack-style nested params), and everything else maps through an encoder whose input type is a strictly-patterned string.
Config = Types::Hash[port: Types::Integer, active: Types::Boolean, on: Types::Date]
decoder, encoder = Plumb::Codec::Forms.for(Config)
decoder.parse({ port: '80', active: '1', on: '2024-01-30' })
# => { port: 80, active: true, on: Date(2024-01-30) }
Defined Under Namespace
Classes: FalseEncoder, FloatEncoder, IntegerEncoder, NilEncoder, NumericEncoder, TrueEncoder
Constant Summary collapse
- INTEGER_EXPR =
/\A-?\d+\z/
Constants inherited from Plumb::Codec
FLOAT_EXPR, FileURIEncoder, HTTPURIEncoder, TIME_EXPR, URI_EXPR
Instance Attribute Summary
Attributes inherited from Plumb::Codec
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
Constructor Details
This class inherits a constructor from Plumb::Codec