Class: Rubyang::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyang/database.rb,
lib/rubyang/database/logger.rb,
lib/rubyang/database/data_tree.rb,
lib/rubyang/database/schema_tree.rb,
lib/rubyang/database/component_manager.rb

Defined Under Namespace

Classes: ComponentManager, DataTree, Logger, SchemaTree

Instance Method Summary collapse

Constructor Details

#initializeDatabase

Returns a new instance of Database.



12
13
14
15
16
17
# File 'lib/rubyang/database.rb', line 12

def initialize
  @yangs       = Array.new
  @schema_tree = SchemaTree.new @yangs
  @config_tree = DataTree.new @schema_tree, Rubyang::Database::DataTree::Mode::CONFIG
  @oper_tree   = DataTree.new @schema_tree, Rubyang::Database::DataTree::Mode::OPER
end

Instance Method Details

#configurationObject



38
39
40
# File 'lib/rubyang/database.rb', line 38

def configuration
  @config_tree.root
end

#configureObject



34
35
36
# File 'lib/rubyang/database.rb', line 34

def configure
  @config_tree.root
end

#load_model(model) ⇒ Object



30
31
32
# File 'lib/rubyang/database.rb', line 30

def load_model model
  @schema_tree.load model
end

#operObject



42
43
44
# File 'lib/rubyang/database.rb', line 42

def oper
  @oper_tree.root
end

#operationalObject



46
47
48
# File 'lib/rubyang/database.rb', line 46

def operational
  @oper_tree.root
end

#to_s(parent = true) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/rubyang/database.rb', line 19

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 "@yangs=#{@yangs.to_s}"
    vars.push "@schema_tree=#{@schema_tree.to_s( false )}"
    vars.push "@config_tree=#{@config_tree.to_s( false )}"
    vars.push "@oper_tree=#{@oper_tree.to_s( false )}"
  end
  head + vars.join(', ') + tail
end