Class: Iqdb::Client::Parser::Response
- Inherits:
-
Object
- Object
- Iqdb::Client::Parser::Response
- Defined in:
- lib/iqdb/client/parser/response.rb
Instance Method Summary collapse
- #additional_matches ⇒ Object
- #best_match ⇒ Object
-
#initialize(html_text) ⇒ Response
constructor
A new instance of Response.
- #possible_matches ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(html_text) ⇒ Response
Returns a new instance of Response.
5 6 7 |
# File 'lib/iqdb/client/parser/response.rb', line 5 def initialize(html_text) @page = Nokogiri::HTML.parse(html_text) end |
Instance Method Details
#additional_matches ⇒ Object
17 18 19 |
# File 'lib/iqdb/client/parser/response.rb', line 17 def additional_matches @additional_matches ||= find_page_by_text('Additional match').map { |match| Result.new(match) } end |
#best_match ⇒ Object
13 14 15 |
# File 'lib/iqdb/client/parser/response.rb', line 13 def best_match @best_match ||= Result.new(find_page_by_text('Best match').first) end |
#possible_matches ⇒ Object
21 22 23 |
# File 'lib/iqdb/client/parser/response.rb', line 21 def possible_matches @possible_matches ||= find_page_by_text('Possible match').map { |match| Result.new(match) } end |
#success? ⇒ Boolean
9 10 11 |
# File 'lib/iqdb/client/parser/response.rb', line 9 def success? @success ||= find_page_by_text('No relevant matches').first.nil? end |