Module: Rankable
- Included in:
- Flicks::Movie, Movie, Song
- Defined in:
- lib/mixins.rb,
lib/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
23 24 25 |
# File 'lib/rankable.rb', line 23 def <=>(other) other.rank <=> @rank end |
#hit? ⇒ Boolean
11 12 13 |
# File 'lib/rankable.rb', line 11 def hit? self.rank >= 10 end |
#normalized_rank ⇒ Object
19 20 21 |
# File 'lib/rankable.rb', line 19 def normalized_rank self.rank / 2 end |
#status ⇒ Object
15 16 17 |
# File 'lib/rankable.rb', line 15 def status hit? ? "Hit" : "Flop" end |
#thumbs_down ⇒ Object
7 8 9 |
# File 'lib/rankable.rb', line 7 def thumbs_down self.rank -= 1 end |
#thumbs_up ⇒ Object
2 3 4 |
# File 'lib/mixins.rb', line 2 def thumbs_up puts "#{self.title} got a thumbs_up" end |