Class: CC::Formatters::SnapshotFormatter::Rating
- Inherits:
-
Object
- Object
- CC::Formatters::SnapshotFormatter::Rating
- Includes:
- Comparable
- Defined in:
- lib/cc/formatters/snapshot_formatter.rb
Overview
Simple Comparator for rating letters.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(letter) ⇒ Rating
constructor
A new instance of Rating.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(letter) ⇒ Rating
Returns a new instance of Rating.
7 8 9 |
# File 'lib/cc/formatters/snapshot_formatter.rb', line 7 def initialize(letter) @letter = letter end |
Instance Method Details
#<=>(other) ⇒ Object
11 12 13 |
# File 'lib/cc/formatters/snapshot_formatter.rb', line 11 def <=>(other) other.to_s <=> to_s end |
#eql?(other) ⇒ Boolean
19 20 21 |
# File 'lib/cc/formatters/snapshot_formatter.rb', line 19 def eql?(other) to_s == other.to_s end |
#hash ⇒ Object
15 16 17 |
# File 'lib/cc/formatters/snapshot_formatter.rb', line 15 def hash @letter.hash end |
#inspect ⇒ Object
23 24 25 |
# File 'lib/cc/formatters/snapshot_formatter.rb', line 23 def inspect "<Rating:#{self}>" end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/cc/formatters/snapshot_formatter.rb', line 27 def to_s @letter.to_s end |