Class: Saxerator::Latches::Within
- Inherits:
-
SaxHandler
- Object
- SaxHandler
- 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
Methods inherited from SaxHandler
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
13 14 15 |
# File 'lib/saxerator/latches/within.rb', line 13 def end_element(_) @depth_within_element -= 1 if @depth_within_element > 0 end |
#open? ⇒ Boolean
17 18 19 |
# File 'lib/saxerator/latches/within.rb', line 17 def open? @depth_within_element > 1 end |
#start_element(name, _) ⇒ Object
9 10 11 |
# File 'lib/saxerator/latches/within.rb', line 9 def start_element(name, _) @depth_within_element += 1 if name == @name || @depth_within_element > 0 end |