Class: Imdb::Movie
- Inherits:
-
Object
- Object
- Imdb::Movie
- Defined in:
- lib/imdb_api_lite/imdb_api_lite.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#genres ⇒ Object
Returns the value of attribute genres.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#title ⇒ Object
Returns the value of attribute title.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(json) ⇒ Movie
constructor
A new instance of Movie.
- #summary ⇒ Object
Constructor Details
#initialize(json) ⇒ Movie
Returns a new instance of Movie.
16 17 18 19 20 21 22 |
# File 'lib/imdb_api_lite/imdb_api_lite.rb', line 16 def initialize(json) @title = json['title'] @year = json['year'] @genres = json['genres'].split(',') @rating = json['rating'] @duration = json['runtime'] end |
Instance Attribute Details
#duration ⇒ Object
Returns the value of attribute duration.
14 15 16 |
# File 'lib/imdb_api_lite/imdb_api_lite.rb', line 14 def duration @duration end |
#genres ⇒ Object
Returns the value of attribute genres.
14 15 16 |
# File 'lib/imdb_api_lite/imdb_api_lite.rb', line 14 def genres @genres end |
#rating ⇒ Object
Returns the value of attribute rating.
14 15 16 |
# File 'lib/imdb_api_lite/imdb_api_lite.rb', line 14 def @rating end |
#title ⇒ Object
Returns the value of attribute title.
14 15 16 |
# File 'lib/imdb_api_lite/imdb_api_lite.rb', line 14 def title @title end |
#year ⇒ Object
Returns the value of attribute year.
14 15 16 |
# File 'lib/imdb_api_lite/imdb_api_lite.rb', line 14 def year @year end |
Instance Method Details
#summary ⇒ Object
24 25 26 27 28 29 |
# File 'lib/imdb_api_lite/imdb_api_lite.rb', line 24 def summary "#{@title} (#{@year})\n" + \ "Rating: #{@rating}\n" + \ "Genres: #{@genres.join(', ')}\n" + \ "Duration: #{@duration}" end |