Class: Observance::Observation

Inherits:
Struct
  • Object
show all
Includes:
Comparable
Defined in:
lib/observance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#indexObject

Returns the value of attribute index

Returns:

  • (Object)

    the current value of index



5
6
7
# File 'lib/observance.rb', line 5

def index
  @index
end

#objectObject

Returns the value of attribute object

Returns:

  • (Object)

    the current value of object



5
6
7
# File 'lib/observance.rb', line 5

def object
  @object
end

#ratingObject

Returns the value of attribute rating

Returns:

  • (Object)

    the current value of rating



5
6
7
# File 'lib/observance.rb', line 5

def rating
  @rating
end

Instance Method Details

#<=>(other) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/observance.rb', line 8

def <=>(other)
  return nil unless other.is_a? self.class
  if other.rating == self.rating
    self.index <=> other.index
  else
    other.rating <=> self.rating
  end
end