Class: Coelacanth::Dom

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

Overview

Coelacanth::Dom

Instance Method Summary collapse

Instance Method Details

#oga(url, html: nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/coelacanth/dom.rb', line 9

def oga(url, html: nil)
  html ||= begin
    Coelacanth::HTTP.get_response(URI.parse(url)).body
  rescue Coelacanth::TimeoutError
    ""
  end
  Oga.parse_xml(html.to_s)
end