Module: Rankable

Included in:
Flicks::Movie
Defined in:
lib/flicks/rankable.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



18
19
20
# File 'lib/flicks/rankable.rb', line 18

def <=> other
  other.rank <=> self.rank
end

#hit?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/flicks/rankable.rb', line 10

def hit?
  self.rank >= 10 
end

#normalized_rankObject



22
23
24
# File 'lib/flicks/rankable.rb', line 22

def normalized_rank
  self.rank/10
end

#statusObject



14
15
16
# File 'lib/flicks/rankable.rb', line 14

def status
  hit? ? "hit" : "flop"
end

#thumbs_downObject



6
7
8
# File 'lib/flicks/rankable.rb', line 6

def thumbs_down
  self.rank-=1
end

#thumbs_upObject



2
3
4
# File 'lib/flicks/rankable.rb', line 2

def thumbs_up
  self.rank+=1
end