Class: Iqdb::Client::Parser::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/iqdb/client/parser/response.rb

Instance Method Summary collapse

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_matchesObject



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_matchObject



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_matchesObject



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

Returns:

  • (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