Class: Tree

Inherits:
Object
  • Object
show all
Includes:
ManipulateNode
Defined in:
public/app/models/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ManipulateNode

#inheritance, #process_mixed_content, #strip_mixed_content

Constructor Details

#initialize(tree_json) ⇒ Tree

Returns a new instance of Tree.



6
7
8
9
10
# File 'public/app/models/tree.rb', line 6

def initialize(tree_json)
  @json = tree_json

  @breadcrumb = prepare_breadcrumb
end

Instance Attribute Details

Returns the value of attribute breadcrumb



4
5
6
# File 'public/app/models/tree.rb', line 4

def breadcrumb
  @breadcrumb
end

#childrenObject (readonly)

Returns the value of attribute children



4
5
6
# File 'public/app/models/tree.rb', line 4

def children
  @children
end

#jsonObject (readonly)

Returns the value of attribute json



4
5
6
# File 'public/app/models/tree.rb', line 4

def json
  @json
end

Instance Method Details

#[](k) ⇒ Object



12
13
14
# File 'public/app/models/tree.rb', line 12

def [](k)
  @json[k]
end

#dig(k) ⇒ Object



16
17
18
# File 'public/app/models/tree.rb', line 16

def dig(k)
  @json.dig(k)
end