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.
The event payload specific to the event type
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
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
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
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
Return the event as a Hash.
# File lib/arborist/event.rb, line 58
def to_h
return {
type: self.type,
data: self.payload
}
end
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