Class: Mint::DocumentTreeNode

Inherits:
Object
  • Object
show all
Defined in:
lib/mint/document_tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, pathname:, title:, depth: 0, is_file: false) ⇒ DocumentTreeNode

Returns a new instance of DocumentTreeNode.



146
147
148
149
150
151
152
153
# File 'lib/mint/document_tree.rb', line 146

def initialize(name:, pathname:, title:, depth: 0, is_file: false)
  @name = name
  @pathname = pathname
  @title = title
  @depth = depth
  @is_file = is_file
  @children = []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



144
145
146
# File 'lib/mint/document_tree.rb', line 144

def children
  @children
end

#depthObject (readonly)

Returns the value of attribute depth.



144
145
146
# File 'lib/mint/document_tree.rb', line 144

def depth
  @depth
end

#nameObject (readonly)

Returns the value of attribute name.



144
145
146
# File 'lib/mint/document_tree.rb', line 144

def name
  @name
end

#pathnameObject (readonly)

Returns the value of attribute pathname.



144
145
146
# File 'lib/mint/document_tree.rb', line 144

def pathname
  @pathname
end

#titleObject (readonly)

Returns the value of attribute title.



144
145
146
# File 'lib/mint/document_tree.rb', line 144

def title
  @title
end

Instance Method Details

#directory?Boolean

Returns:

  • (Boolean)


159
160
161
# File 'lib/mint/document_tree.rb', line 159

def directory?
  !@is_file
end

#file?Boolean

Returns:

  • (Boolean)


155
156
157
# File 'lib/mint/document_tree.rb', line 155

def file?
  @is_file
end