Class: CheckMot::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/check_mot/attribute.rb

Direct Known Subclasses

DateAttribute

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Attribute

Returns a new instance of Attribute.



6
7
8
# File 'lib/check_mot/attribute.rb', line 6

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/check_mot/attribute.rb', line 4

def value
  @value
end

Class Method Details

.resolve(name, value) ⇒ Object



10
11
12
13
14
# File 'lib/check_mot/attribute.rb', line 10

def self.resolve(name, value)
  [DateAttribute].map do |attribute|
    attribute.try(name, value)
  end.first || value
end