class Yaks::Mapper::Form::Field::Option

<option>, as used in a <select>

Public Class Methods

create(value, opts) click to toggle source
# File lib/yaks/mapper/form/field/option.rb, line 9
def self.create(value, opts)
  new(opts.merge(value: value))
end

Public Instance Methods

to_resource_field_option(mapper) click to toggle source
# File lib/yaks/mapper/form/field/option.rb, line 13
def to_resource_field_option(mapper)
  return unless self.if.nil? || mapper.expand_value(self.if)

  Resource::Form::Field::Option.new(
    value: mapper.expand_value(value),
    label: mapper.expand_value(label),
    selected: mapper.expand_value(selected),
    disabled: mapper.expand_value(disabled)
  )
end