Module: Ecfr::FacetAttributeMethodDefinition::ClassMethods

Defined in:
lib/ecfr/facet_attribute_method_definition.rb

Instance Method Summary collapse

Instance Method Details

#attribute(*attribute) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ecfr/facet_attribute_method_definition.rb', line 4

def attribute(*attribute)
  as = attribute.last.delete(:as)

  case as
  when :key
    self.fk = attribute.first.to_s
  when :value
    self.fv = attribute.first.to_s
  else
    raise "must set :as to either :key or :value, was: #{as}"
  end

  super(*attribute)
end