class FieldMapper::FieldAccessByStandardName

Attributes

custom_plat[R]
fields_by_standard_name[R]

Public Class Methods

new(custom_plat) click to toggle source
# File lib/field_mapper/custom/field_access_by_standard_name.rb, line 4
def initialize(custom_plat)
  @custom_plat = custom_plat
  @fields_by_standard_name = custom_plat.class.fields_by_standard_name
end

Public Instance Methods

[](standard_name) click to toggle source
# File lib/field_mapper/custom/field_access_by_standard_name.rb, line 9
def [](standard_name)
  custom_field = field(standard_name)
  custom_plat[custom_field.name]
end
[]=(standard_name, value) click to toggle source
# File lib/field_mapper/custom/field_access_by_standard_name.rb, line 14
def []=(standard_name, value)
  custom_field = field(standard_name)
  custom_plat[custom_field.name] = value
end

Private Instance Methods

field(standard_name) click to toggle source
# File lib/field_mapper/custom/field_access_by_standard_name.rb, line 23
def field(standard_name)
  fields_by_standard_name[standard_name.to_sym]
end