Module: Rankable

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

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



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

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



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

def normalized_rank
    self.rank
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