Event

class
Superclass
Object
Extended With
Pluggability
Loggability

The representation of activity in the manager; events are broadcast when node state changes, when they're updated, and when various other operational actions take place, e.g., the node tree gets reloaded.

Attributes

payload[R]

The event payload specific to the event type

Public Class Methods

anchor
new( payload )

Create a new event with the specified payload data.

# File lib/arborist/event.rb, line 24
def initialize( payload )
        payload = payload.clone unless payload.nil?
        @payload = payload
end

Public Instance Methods

anchor
=~( object )
Alias for: match
anchor
inspect()

Return a string representation of the object suitable for debugging.

# File lib/arborist/event.rb, line 67
def inspect
        return "#<%p:%#016x %s>" % [
                self.class,
                self.object_id * 2,
                self.inspect_details,
        ]
end
anchor
inspect_details()

Return the detail portion of the inspect string appropriate for this event type.

# File lib/arborist/event.rb, line 77
def inspect_details
        return self.payload.inspect
end
anchor
match( object )

Match operator – returns true if the other object matches this event.

# File lib/arborist/event.rb, line 48
def match( object )
        rval = object.respond_to?( :event_type ) &&
           ( object.event_type.nil? || object.event_type == self.type )
        self.log.debug "Base node #match: %p" % [ rval ]
        return rval
end
Also aliased as: =~
anchor
to_h()

Return the event as a Hash.

# File lib/arborist/event.rb, line 58
def to_h
        return {
                type: self.type,
                data: self.payload
        }
end
anchor
type()

Return the type of the event.

# File lib/arborist/event.rb, line 39
def type
        return self.class.name.
                sub( /.*::/, '' ).
                gsub( /([a-z])([A-Z])/, '\1.\2' ).
                downcase
end