Class: Nokogiri::HTML::Document

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

Instance Method Summary collapse

Instance Method Details

#get_the(search) ⇒ Object



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

def get_the(search)
  self.search(search).first rescue nil
end

#match(*queries) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/csteamer.rb', line 19

def match(*queries)
  queries.each do |query|
    if query.is_a?(String)
      result = self.search(query).first.inner_text.strip rescue nil
    elsif query.is_a?(Array)
      result = query[1].call(self.search(query.first).first).strip rescue nil
    end
    return result if result
  end
  return nil
end