Class: MVCLI::Form::Decoder
- Inherits:
-
Object
- Object
- MVCLI::Form::Decoder
- Defined in:
- lib/mvcli/form.rb
Instance Method Summary collapse
- #call(string) ⇒ Object
-
#initialize(form, names) ⇒ Decoder
constructor
A new instance of Decoder.
- #to_proc ⇒ Object
Constructor Details
#initialize(form, names) ⇒ Decoder
Returns a new instance of Decoder.
29 30 31 |
# File 'lib/mvcli/form.rb', line 29 def initialize(form, names) @form, @names = form, names end |
Instance Method Details
#call(string) ⇒ Object
33 34 35 |
# File 'lib/mvcli/form.rb', line 33 def call(string) @form.new Map Hash[@names.zip string.split ':'] end |
#to_proc ⇒ Object
37 38 39 |
# File 'lib/mvcli/form.rb', line 37 def to_proc proc {|*_| call(*_)} end |