class Saxerator::Latches::AtDepth

Public Class Methods

new(depth) click to toggle source
# File lib/saxerator/latches/at_depth.rb, line 4
def initialize(depth)
  @target_depth = depth
  @current_depth = -1
end

Public Instance Methods

end_element(_) click to toggle source
# File lib/saxerator/latches/at_depth.rb, line 13
def end_element(_)
  @current_depth -= 1
end
open?() click to toggle source
# File lib/saxerator/latches/at_depth.rb, line 17
def open?
  @current_depth == @target_depth
end
start_element(_, __) click to toggle source
# File lib/saxerator/latches/at_depth.rb, line 9
def start_element(_, __)
  @current_depth += 1
end