| Class | Root |
| In: |
lib/core/root.rb
|
| Parent: | Object |
The Root class is the mother of all objects.
# File lib/core/root.rb, line 30 def initialize(name, owner) self.id # The database id of the object self.name = name # The displayed name of the object self.owner = owner || id # The owner of the object or itself. self.desc = "" # The description of the object self.created_on = Time.now self.updated_on = created_on.dup end
# File lib/core/root.rb, line 76 def add_event(from,to,kind,msg=nil) Engine.instance.eventmgr.add_event(from,to,kind,msg) end
Clone an object This does a deepcopy then assign a new database id
# File lib/core/root.rb, line 54 def clone newobj = Marshal.load(Marshal.dump(self)) props = newobj.instance_variable_get(:@props) props[:id] = Engine.instance.db.getid put_object(newobj) newobj rescue log.error "Clone failed" nil end
formatted dump of object properties
# File lib/core/root.rb, line 41 def inspect s = '' @props.each do |key,val| s << sprintf("%-20.20s : %-40.40s\n", key.to_s, val.inspect) end s end
All command input routed through here and parsed.
# File lib/core/root.rb, line 68 def parse(m) false end