Class: MVCLI::Form::Decoder

Inherits:
Object
  • Object
show all
Defined in:
lib/mvcli/form.rb

Instance Method Summary collapse

Constructor Details

#initialize(form, names) ⇒ Decoder

Returns a new instance of Decoder.



27
28
29
# File 'lib/mvcli/form.rb', line 27

def initialize(form, names)
  @form, @names = form, names
end

Instance Method Details

#call(string) ⇒ Object



31
32
33
# File 'lib/mvcli/form.rb', line 31

def call(string)
  @form.new Map Hash[@names.zip string.split ':']
end

#to_proc ⇒ Object



35
36
37
# File 'lib/mvcli/form.rb', line 35

def to_proc
  proc {|*_| call(*_)}
end