Class: Chop::Form::MultipleCheckbox

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

Instance Method Details

#fill_in!Object



110
111
112
113
114
# File 'lib/chop/form.rb', line 110

def fill_in!
  checkboxes.each do |checkbox|
    checkbox.set checkbox_label_in_values?(checkbox)
  end
end

#get_valueObject



116
117
118
# File 'lib/chop/form.rb', line 116

def get_value
  checkboxes.select(&:checked?).map(&:value).join(", ")
end

#matches?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/chop/form.rb', line 106

def matches?
  field[:type] == "checkbox" && field[:name].to_s.end_with?("[]")
end