Class: Saxerator::Latches::Within
- Inherits:
-
Nokogiri::XML::SAX::Document
- Object
- Nokogiri::XML::SAX::Document
- Saxerator::Latches::Within
- Defined in:
- lib/saxerator/latches/within.rb
Instance Method Summary collapse
- #end_element(_) ⇒ Object
-
#initialize(name) ⇒ Within
constructor
A new instance of Within.
- #open? ⇒ Boolean
- #start_element(name, _) ⇒ Object
Constructor Details
#initialize(name) ⇒ Within
Returns a new instance of Within.
4 5 6 7 |
# File 'lib/saxerator/latches/within.rb', line 4 def initialize(name) @name = name @depth_within_element = 0 end |
Instance Method Details
#end_element(_) ⇒ Object
15 16 17 18 19 |
# File 'lib/saxerator/latches/within.rb', line 15 def end_element _ if @depth_within_element > 0 @depth_within_element -= 1 end end |
#open? ⇒ Boolean
21 22 23 |
# File 'lib/saxerator/latches/within.rb', line 21 def open? @depth_within_element > 1 end |
#start_element(name, _) ⇒ Object
9 10 11 12 13 |
# File 'lib/saxerator/latches/within.rb', line 9 def start_element name, _ if name == @name || @depth_within_element > 0 @depth_within_element += 1 end end |