class Formulaic::Inputs::ArrayInput

Public Instance Methods

fill() click to toggle source
# File lib/formulaic/inputs/array_input.rb, line 4
def fill
  attempt_to_fill_selects ||
    attempt_to_fill_checkboxes ||
    raise_input_error
end

Private Instance Methods

attempt_to_fill_checkboxes() click to toggle source
# File lib/formulaic/inputs/array_input.rb, line 16
def attempt_to_fill_checkboxes
  CheckboxInput.new(label, value).fill
end
attempt_to_fill_selects() click to toggle source
# File lib/formulaic/inputs/array_input.rb, line 12
def attempt_to_fill_selects
  SelectInput.new(label, value).fill
end
contains_all_options?(nodes) click to toggle source
# File lib/formulaic/inputs/array_input.rb, line 20
def contains_all_options?(nodes)
  nodes.map(&:text).to_set.superset?(value.to_set)
end
raise_input_error() click to toggle source
# File lib/formulaic/inputs/array_input.rb, line 24
def raise_input_error
  raise(
    InputNotFound,
    %[Unable to find checkboxes or select[multiple] "#{label}" containing all options #{value.inspect}.]
  )
end