Module: ClassyAttribute::InstanceMethods

Includes:
Comparable
Defined in:
lib/classy_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject

Returns the value of attribute value.



25
26
27
# File 'lib/classy_attribute.rb', line 25

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/classy_attribute.rb', line 33

def <=>(other)
  return if other.class != self.class

  if value < other.value
    -1
  elsif value == other.value
    0
  else value > other.value
    1
  end
end

#initialize(value) ⇒ Object



27
28
29
# File 'lib/classy_attribute.rb', line 27

def initialize(value)
  self.value = value
end