Class: Plumb::Codec::Forms::NilEncoder

Inherits:
Object
  • Object
show all
Defined in:
lib/plumb/codec.rb

Overview

An empty or absent form field is nil — so Types::Date | Types::Nil decodes '' AND a literal nil (valueless params, eg. Rack's parse_nested_query('x')) to nil, and '2024-01-30' to a Date. The Nil in the input is left as a literal acceptance during input rewriting (it is noop-covered), not recursively re-encoded.

Instance Method Summary collapse

Instance Method Details

#decode(_value) ⇒ Object



783
# File 'lib/plumb/codec.rb', line 783

def decode(_value) = nil

#encode(_nil) ⇒ Object



782
# File 'lib/plumb/codec.rb', line 782

def encode(_nil) = ''