Class: ImdbCelebrity::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/imdb_celebrity/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, parser = "HpricotParser") ⇒ Search

Returns a new instance of Search.



9
10
11
12
13
# File 'lib/imdb_celebrity/search.rb', line 9

def initialize(query, parser ="HpricotParser")
  @query = search_uri query
  @parser_text = parser
  @parser = initialize_parser parser
end

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.



7
8
9
# File 'lib/imdb_celebrity/search.rb', line 7

def parser
  @parser
end

#queryObject (readonly)

Returns the value of attribute query.



7
8
9
# File 'lib/imdb_celebrity/search.rb', line 7

def query
  @query
end

Instance Method Details

#celebritiesObject



15
16
17
# File 'lib/imdb_celebrity/search.rb', line 15

def celebrities
  @celebrities = (@parser.exact_match? ? @parser.parse_celebrity : parse_celebrities)
end