Class: Tree::TreeNode

Inherits:
Object
  • Object
show all
Defined in:
lib/not_naughty/error_handler.rb

Instance Method Summary collapse

Instance Method Details

#closest(obj) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/not_naughty/error_handler.rb', line 3

def closest(obj)
  if @name == obj then self
  elsif @name > obj
    closest = self
    @children.any? { |child| node = child.closest(obj) and closest = node }
    
    closest
  end
end