Sha256: 3da9a8ba99d33cfadc8bb0a48ef12c46cfcaa1d7f586c07ef9a9a35cf51f82c9

Contents?: true

Size: 440 Bytes

Versions: 8

Compression:

Stored size: 440 Bytes

Contents

module ActiveElement
  class FieldOptions
    attr_accessor :type, :options, :value
    attr_reader :field

    def self.from_state(field, state, record, controller)
      block = state.field_options[field]
      return nil if block.blank?

      field_options = new(field)
      block.call(field_options, record, controller)
      field_options
    end

    def initialize(field)
      @field = field
      @options = {}
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_element-0.0.29 lib/active_element/field_options.rb
active_element-0.0.28 lib/active_element/field_options.rb
active_element-0.0.27 lib/active_element/field_options.rb
active_element-0.0.26 lib/active_element/field_options.rb
active_element-0.0.24 lib/active_element/field_options.rb
active_element-0.0.23 lib/active_element/field_options.rb
active_element-0.0.22 lib/active_element/field_options.rb
active_element-0.0.21 lib/active_element/field_options.rb