Class: Rubyang::Database::DataTree

Inherits:
Object
  • Object
show all
Includes:
DRb::DRbUndumped
Defined in:
lib/rubyang/database/data_tree.rb

Defined Under Namespace

Modules: Mode Classes: Anyxml, Container, InteriorNode, Leaf, LeafList, LeafListElement, LeafNode, List, ListElement, ListNode, Node, Root

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_tree, mode = Rubyang::Database::DataTree::Mode::CONFIG) ⇒ DataTree

Returns a new instance of DataTree.



1117
1118
1119
1120
1121
1122
1123
1124
# File 'lib/rubyang/database/data_tree.rb', line 1117

def initialize schema_tree, mode=Rubyang::Database::DataTree::Mode::CONFIG
  @logger = Logger.new(self.class.name)
  @db_mode = mode
  @ctx_mode = Rubyang::Database::DataTree::Mode::CONFIG
  @root = Root.new( self, schema_tree, schema_tree.root, @db_mode, @ctx_mode )
  @history = Array.new
  @component_manager = Rubyang::Database::ComponentManager.new
end

Instance Attribute Details

#component_managerObject

Returns the value of attribute component_manager.



1116
1117
1118
# File 'lib/rubyang/database/data_tree.rb', line 1116

def component_manager
  @component_manager
end

Instance Method Details

#historyObject



1134
1135
1136
# File 'lib/rubyang/database/data_tree.rb', line 1134

def history
  @history
end

#rootObject



1137
1138
1139
# File 'lib/rubyang/database/data_tree.rb', line 1137

def root
  @root
end

#to_s(parent = true) ⇒ Object



1125
1126
1127
1128
1129
1130
1131
1132
1133
# File 'lib/rubyang/database/data_tree.rb', line 1125

def to_s parent=true
  head, vars, tail = "#<#{self.class.to_s}:0x#{(self.object_id << 1).to_s(16).rjust(14,'0')} ", Array.new, ">"
  if parent
    vars.push "@yang=#{@root.to_s}"
    vars.push "@history=#{@history.to_s}"
    vars.push "@component_manager=#{@component_manager.to_s}"
  end
  head + vars.join(', ') + tail
end