Class: BoxOffice::Movie

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMovie

Returns a new instance of Movie.



7
8
9
# File 'lib/box_office/movie.rb', line 7

def initialize
  @@all << self
end

Instance Attribute Details

#audience_scoreObject

Returns the value of attribute audience_score.



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

def audience_score
  @audience_score
end

#castObject

Returns the value of attribute cast.



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

def cast
  @cast
end

#critic_scoreObject

Returns the value of attribute critic_score.



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

def critic_score
  @critic_score
end

#directorObject

Returns the value of attribute director.



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

def director
  @director
end

#earningsObject

Returns the value of attribute earnings.



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

def earnings
  @earnings
end

#genresObject

Returns the value of attribute genres.



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

def genres
  @genres
end

Returns the value of attribute link.



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

def link
  @link
end

#ratingObject

Returns the value of attribute rating.



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

def rating
  @rating
end

#release_dateObject

Returns the value of attribute release_date.



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

def release_date
  @release_date
end

#runtimeObject

Returns the value of attribute runtime.



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

def runtime
  @runtime
end

#studioObject

Returns the value of attribute studio.



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

def studio
  @studio
end

#synopsisObject

Returns the value of attribute synopsis.



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

def synopsis
  @synopsis
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

#writersObject

Returns the value of attribute writers.



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

def writers
  @writers
end

Class Method Details

.allObject



33
34
35
# File 'lib/box_office/movie.rb', line 33

def self.all
  @@all
end

Instance Method Details

#add_movie_attributes(attributes_hash) ⇒ Object



11
12
13
14
15
# File 'lib/box_office/movie.rb', line 11

def add_movie_attributes(attributes_hash)
  attributes_hash.each do |attr, value|
    self.send("#{attr}=", value)
  end
end


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/box_office/movie.rb', line 17

def print_info
  puts "#{self.title}".colorize(:red)
  puts "#{self.synopsis}" if self.synopsis != ""
  puts "" if self.synopsis != ""
  puts "Genres:".colorize(:blue) + " #{self.genres}" if !self.genres.nil?
  puts "Rating:".colorize(:blue) + " #{self.rating}" if !self.rating.nil?
  puts "Studio:".colorize(:blue) + " #{self.studio}" if !self.studio.nil?
  puts "Director:".colorize(:blue) + " #{self.director}" if !self.director.nil?
  puts "Writers:".colorize(:blue) + " #{self.writers}" if !self.writers.nil?
  puts "Main Cast:".colorize(:blue) + " #{self.cast}" if self.cast != ""
  puts "Release Date:".colorize(:blue) + " #{self.release_date}" if !self.release_date.nil?
  puts "Runtime:".colorize(:blue) + " #{self.runtime}" if !self.runtime.nil?
  puts "Critic Score:".colorize(:blue) + " #{self.critic_score}"
  puts "Audience Score:".colorize(:blue) + " #{self.audience_score}"
end