Class: Movie

Inherits:
Object
  • Object
show all
Defined in:
lib/studio_game/movie.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, rank = 0) ⇒ Movie



5
6
7
8
# File 'lib/studio_game/movie.rb', line 5

def initialize(title, rank=0)
  @title = title.capitalize
  @rank = rank
end

Instance Attribute Details

#rankObject (readonly)

Returns the value of attribute rank.



2
3
4
# File 'lib/studio_game/movie.rb', line 2

def rank
  @rank
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/studio_game/movie.rb', line 3

def title
  @title
end

Instance Method Details

#normalized_rankObject



10
11
12
# File 'lib/studio_game/movie.rb', line 10

def normalized_rank
  @rank/10
end

#thumbs_downObject



18
19
20
# File 'lib/studio_game/movie.rb', line 18

def thumbs_down
  @rank -= 1
end

#thumbs_upObject



14
15
16
# File 'lib/studio_game/movie.rb', line 14

def thumbs_up
  @rank += 1
end

#to_sObject



22
23
24
# File 'lib/studio_game/movie.rb', line 22

def to_s
  "#{@title} has a rank of #{rank}"
end