Class: Chop::Form::MultipleSelect

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

Instance Attribute Summary

Attributes inherited from Field

#field, #label, #path, #session, #value

Instance Method Summary collapse

Methods inherited from Field

candidates, for, from, #get_value

Instance Method Details

#fill_in!Object



85
86
87
88
89
90
91
92
# File 'lib/chop/form.rb', line 85

def fill_in!
  field.all("option").map(&:text).each do |value|
    session.unselect value, from: label
  end
  value.split(", ").each do |value|
    session.select value, from: label
  end
end

#matches?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/chop/form.rb', line 81

def matches?
  field.tag_name == "select" && field[:multiple]
end