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.



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_procObject



37
38
39
# File 'lib/mvcli/form.rb', line 37

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