class Formulaic::Inputs::SelectInput

Public Instance Methods

fill() click to toggle source
# File lib/formulaic/inputs/select_input.rb, line 4
def fill
  if has_multiple_select?
    select_options
    true
  else
    false
  end
end

Private Instance Methods

has_multiple_select?() click to toggle source
# File lib/formulaic/inputs/select_input.rb, line 19
def has_multiple_select?
  has_select? && select_is_multiple?
end
has_select?() click to toggle source
# File lib/formulaic/inputs/select_input.rb, line 23
def has_select?
  has_field?(label.to_str, type: "select")
end
select_element() click to toggle source
# File lib/formulaic/inputs/select_input.rb, line 32
def select_element
  @select_element ||= find_field(label.to_str, type: "select")
end
select_is_multiple?() click to toggle source
# File lib/formulaic/inputs/select_input.rb, line 27
def select_is_multiple?
  select_element[:multiple].present? &&
    contains_all_options?(select_element.all("option"))
end
select_options() click to toggle source
# File lib/formulaic/inputs/select_input.rb, line 15
def select_options
  value.each { |option| select option, from: label.to_str }
end