Root

class
Superclass
Arborist::Node
Extended With
Arborist::MethodUtilities

The class of the root node of an Arborist tree. This class is a Singleton.

Public Class Methods

anchor
instance( * )

Override the default constructor to use the singleton ::instance instead.

# File lib/arborist/node/root.rb, line 23
def self::instance( * )
        @instance ||= new
        return @instance
end
anchor
new( * )

Set up the root node.

# File lib/arborist/node/root.rb, line 36
def initialize( * )
        super( '_' ) do
                description "The root node."
                source = URI( __FILE__ )
        end

        @status = 'up'
        @status.freeze
end
anchor
new( * )

Create the instance of the Root node (if necessary) and return it.

# File lib/arborist/node/root.rb, line 16
def self::new( * )
        @instance ||= super
        return @instance
end
anchor
reset()

Reset the singleton instance; mainly used for testing.

# File lib/arborist/node/root.rb, line 30
def self::reset
        @instance = nil
end

Public Instance Methods

anchor
on_node_enabled( transition )

Callback for when a node goes from disabled to unknown. Override, so we immediately transition from unknown to up.

# File lib/arborist/node/root.rb, line 61
def on_node_enabled( transition )
        super
        events = self.update( {} ) # up!
        self.publish_events( events )
end
anchor
parent( * )

Override the reader mode of Node#parent for the root node, which never has a parent.

# File lib/arborist/node/root.rb, line 70
def parent( * )
        return nil
end
anchor
restore( other_node )

Ignore restores of serialized root nodes.

# File lib/arborist/node/root.rb, line 48
def restore( other_node )
        self.log.info "Ignoring restored root node."
end
anchor
update( properties, monitor_key='_' )

Don't allow properties to be set on the root node.

# File lib/arborist/node/root.rb, line 54
def update( properties, monitor_key='_' )
        return super( {} )
end