Class: ParamsReady::Value::GenericCoder

Inherits:
Object
  • Object
show all
Extended by:
Extensions::Finalizer, Extensions::LateInit
Includes:
Extensions::Finalizer::InstanceMethods, Coercion
Defined in:
lib/params_ready/value/coder.rb

Instance Method Summary collapse

Methods included from Extensions::LateInit

late_init

Methods included from Extensions::Finalizer

obligatory, obligatory!

Methods included from Coercion

#strict_default?, #try_coerce

Constructor Details

#initialize(name) ⇒ GenericCoder

Returns a new instance of GenericCoder.



69
70
71
72
73
74
# File 'lib/params_ready/value/coder.rb', line 69

def initialize(name)
  @name = name
  @coerce = nil
  @format = nil
  @type_identifier = nil
end

Instance Method Details

#coerce(input, context) ⇒ Object



84
85
86
# File 'lib/params_ready/value/coder.rb', line 84

def coerce(input, context)
  @coerce[input, context]
end

#finishObject



92
93
94
95
# File 'lib/params_ready/value/coder.rb', line 92

def finish
  super
  freeze
end

#format(value, format) ⇒ Object



88
89
90
# File 'lib/params_ready/value/coder.rb', line 88

def format(value, format)
  @format[value, format]
end

#value_class_nameObject



80
81
82
# File 'lib/params_ready/value/coder.rb', line 80

def value_class_name
  @name
end