Method: Lhj::Tree::Node#initialize

Defined in:
lib/lhj/tree/node.rb

#initialize(path, parent, prefix, level) ⇒ Node

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Node.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/lhj/tree/node.rb', line 35

def initialize(path, parent, prefix, level)
  if path.is_a? String
    # strip null bytes from the string to avoid throwing errors
    path = path.delete("\0")
  end

  @path = Pathname.new(path)
  @name   = @path.basename
  @parent = Pathname.new(parent)
  @prefix = prefix
  @level  = level
end