Class: Library::Tree
- Inherits:
-
Object
- Object
- Library::Tree
- Defined in:
- lib/danta/library/tree.rb
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#paths ⇒ Object
Returns the value of attribute paths.
Instance Method Summary collapse
-
#initialize(paths:) ⇒ Tree
constructor
A new instance of Tree.
- #to_h ⇒ Object
- #to_json ⇒ Object
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
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
8 9 10 |
# File 'lib/danta/library/tree.rb', line 8 def nodes @nodes end |
#paths ⇒ Object
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_h ⇒ Object
19 20 21 |
# File 'lib/danta/library/tree.rb', line 19 def to_h nodes.map(&:to_h) end |
#to_json ⇒ Object
23 24 25 |
# File 'lib/danta/library/tree.rb', line 23 def to_json to_h.to_json end |