Class: Ddr::Index::FieldAttribute

Inherits:
Virtus::Attribute
  • Object
show all
Defined in:
lib/ddr/index/field_attribute.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.coerce(value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/ddr/index/field_attribute.rb', line 6

def self.coerce(value)
  case value
  when Field
    value
  when String
    Field.new(value)
  when Symbol
    Fields.get(value)
  end
end

Instance Method Details

#coerce(value) ⇒ Object



17
18
19
# File 'lib/ddr/index/field_attribute.rb', line 17

def coerce(value)
  self.class.coerce(value)
end