Class: Imdb::Search
Overview
Search IMDB for a title
Instance Attribute Summary (collapse)
-
- (Object) query
readonly
Returns the value of attribute query.
Instance Method Summary (collapse)
-
- (Search) initialize(query)
constructor
Initialize a new IMDB search with the specified query.
-
- (Object) movies
Returns an array of Imdb::Movie objects for easy search result yielded.
Constructor Details
- (Search) initialize(query)
Initialize a new IMDB search with the specified query
search = Imdb::Search.new("Star Trek")
Imdb::Search is lazy loading, meaning that unless you access the movies attribute, no query is made to IMDB.com.
14 15 16 |
# File 'lib/imdb/search.rb', line 14 def initialize(query) @query = query end |
Instance Attribute Details
- (Object) query (readonly)
Returns the value of attribute query
5 6 7 |
# File 'lib/imdb/search.rb', line 5 def query @query end |
Instance Method Details
- (Object) movies
Returns an array of Imdb::Movie objects for easy search result yielded. If the query was an exact match, a single element array will be returned.
20 21 22 |
# File 'lib/imdb/search.rb', line 20 def movies @movies ||= (exact_match? ? parse_movie : parse_movies) end |