Class: Library::Tree

Inherits:
Object
  • Object
show all
Defined in:
lib/danta/library/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paths:) ⇒ Tree

Returns a new instance of Tree.



11
12
13
# File 'lib/danta/library/tree.rb', line 11

def initialize(paths:)
  @paths = paths
end

Instance Attribute Details

#nodesObject (readonly)

Returns the value of attribute nodes.



8
9
10
# File 'lib/danta/library/tree.rb', line 8

def nodes
  @nodes
end

#pathsObject

Returns the value of attribute paths.



9
10
11
# File 'lib/danta/library/tree.rb', line 9

def paths
  @paths
end

Instance Method Details

#to_hObject



19
20
21
# File 'lib/danta/library/tree.rb', line 19

def to_h
  nodes.map(&:to_h)
end

#to_jsonObject



23
24
25
# File 'lib/danta/library/tree.rb', line 23

def to_json
  to_h.to_json
end