Method: Needle::Container#root

Defined in:
lib/needle/container.rb

#rootObject

Returns the root of the current hierarchy. If the container is the root, returns self, otherwise calls Container#root on its parent. The value is cached for future reference.



62
63
64
65
66
# File 'lib/needle/container.rb', line 62

def root
  return @root if @root
  return self if parent.nil?
  @root = parent.root
end