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.
42 43 44 |
# File 'lib/mvcli/form.rb', line 42 def initialize(form, names) @form, @names = form, names end |
Instance Method Details
#call(string) ⇒ Object
46 47 48 |
# File 'lib/mvcli/form.rb', line 46 def call(string) @form.new Map Hash[@names.zip string.split ':'] end |
#to_proc ⇒ Object
50 51 52 |
# File 'lib/mvcli/form.rb', line 50 def to_proc method(:call).to_proc end |