Class: Dropdown::Parsers::MetadataParser
- Inherits:
-
Object
- Object
- Dropdown::Parsers::MetadataParser
- Includes:
- Parser
- Defined in:
- lib/dropdown/parsers/metadata_parser.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
Attributes included from Parser
Instance Method Summary collapse
-
#initialize(content) ⇒ MetadataParser
constructor
A new instance of MetadataParser.
- #parse ⇒ Object
Constructor Details
#initialize(content) ⇒ MetadataParser
Returns a new instance of MetadataParser.
11 12 13 14 |
# File 'lib/dropdown/parsers/metadata_parser.rb', line 11 def initialize(content) super @headers = {} end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
9 10 11 |
# File 'lib/dropdown/parsers/metadata_parser.rb', line 9 def headers @headers end |
Instance Method Details
#parse ⇒ Object
16 17 18 19 |
# File 'lib/dropdown/parsers/metadata_parser.rb', line 16 def parse doc = Nokogiri::HTML.parse(@content) doc.xpath('//comment()').each { |comment| extract_header(comment.content) } end |