Module: Rankable
- Included in:
- Flicks::Movie
- Defined in:
- lib/flicks/Rankable.rb
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #hit? ⇒ Boolean
- #normalized_rank ⇒ Object
- #status ⇒ Object
- #thumbs_down ⇒ Object
- #thumbs_up ⇒ Object
Instance Method Details
#<=>(other) ⇒ Object
22 23 24 |
# File 'lib/flicks/Rankable.rb', line 22 def <=>(other) other.rank <=> self.rank end |
#hit? ⇒ Boolean
10 11 12 |
# File 'lib/flicks/Rankable.rb', line 10 def hit? self.rank >= 10 end |
#normalized_rank ⇒ Object
18 19 20 |
# File 'lib/flicks/Rankable.rb', line 18 def normalized_rank self.rank / 10 end |
#status ⇒ Object
14 15 16 |
# File 'lib/flicks/Rankable.rb', line 14 def status hit? ? "Hit" : "Flop" end |
#thumbs_down ⇒ Object
6 7 8 |
# File 'lib/flicks/Rankable.rb', line 6 def thumbs_down self.rank -= 1 end |
#thumbs_up ⇒ Object
2 3 4 |
# File 'lib/flicks/Rankable.rb', line 2 def thumbs_up self.rank += 1 end |