Class: Saxerator::Latches::AtDepth
- Inherits:
-
SaxHandler
- Object
- SaxHandler
- Saxerator::Latches::AtDepth
- Defined in:
- lib/saxerator/latches/at_depth.rb
Instance Method Summary collapse
- #end_element(_) ⇒ Object
-
#initialize(depth) ⇒ AtDepth
constructor
A new instance of AtDepth.
- #open? ⇒ Boolean
- #start_element(_, __) ⇒ Object
Methods inherited from SaxHandler
Constructor Details
#initialize(depth) ⇒ AtDepth
Returns a new instance of AtDepth.
4 5 6 7 |
# File 'lib/saxerator/latches/at_depth.rb', line 4 def initialize(depth) @target_depth = depth @current_depth = -1 end |
Instance Method Details
#end_element(_) ⇒ Object
13 14 15 |
# File 'lib/saxerator/latches/at_depth.rb', line 13 def end_element(_) @current_depth -= 1 end |
#open? ⇒ Boolean
17 18 19 |
# File 'lib/saxerator/latches/at_depth.rb', line 17 def open? @current_depth == @target_depth end |
#start_element(_, __) ⇒ Object
9 10 11 |
# File 'lib/saxerator/latches/at_depth.rb', line 9 def start_element(_, __) @current_depth += 1 end |