Class: Ogpr::Parser

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Parser

Returns a new instance of Parser.



14
15
16
# File 'lib/ogpr/parser.rb', line 14

def initialize(html)
  @html = html
end

Class Method Details

.parse(str) ⇒ Object



9
10
11
# File 'lib/ogpr/parser.rb', line 9

def parse(str)
  new(str).parse
end

Instance Method Details

#parseObject



18
19
20
21
22
23
# File 'lib/ogpr/parser.rb', line 18

def parse
  doc = Nokogiri::HTML(@html, nil, 'utf-8')
  meta = parse_meta(doc)

  Result.new(meta)
end