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.



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_procObject



50
51
52
# File 'lib/mvcli/form.rb', line 50

def to_proc
  method(:call).to_proc
end