Class: Nori::Parser::Nokogiri::Document
- Inherits:
-
Nokogiri::XML::SAX::Document
- Object
- Nokogiri::XML::SAX::Document
- Nori::Parser::Nokogiri::Document
- Defined in:
- lib/nori/parser/nokogiri.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #characters(string) ⇒ Object (also: #cdata_block)
- #end_element(name) ⇒ Object
- #stack ⇒ Object
- #start_element(name, attrs = []) ⇒ Object
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
12 13 14 |
# File 'lib/nori/parser/nokogiri.rb', line 12 def @options end |
Instance Method Details
#characters(string) ⇒ Object Also known as: cdata_block
29 30 31 |
# File 'lib/nori/parser/nokogiri.rb', line 29 def characters(string) stack.last.add_node(string) unless string.strip.length == 0 || stack.empty? end |
#end_element(name) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/nori/parser/nokogiri.rb', line 22 def end_element(name) if stack.size > 1 last = stack.pop stack.last.add_node last end end |
#stack ⇒ Object
14 15 16 |
# File 'lib/nori/parser/nokogiri.rb', line 14 def stack @stack ||= [] end |
#start_element(name, attrs = []) ⇒ Object
18 19 20 |
# File 'lib/nori/parser/nokogiri.rb', line 18 def start_element(name, attrs = []) stack.push Nori::XMLUtilityNode.new(, name, Hash[*attrs.flatten]) end |