Sha256: 8b32cfad67c6b1b3ea7f2d4899a2522750a1df58062469bed61fb6803712e1a7
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
# -*- ruby -*- #encoding: utf-8 require 'arborist/event' unless defined?( Arborist::Event ) # A mixin which adds common functionality to events which related to an # Arborist::Node. module Arborist::Event::NodeMatching ### Strip and save the node argument to the constructor. def initialize( node, payload=nil ) @node = node super( payload ) end ###### public ###### # The node that generated the event attr_reader :node ### Returns +true+ if the specified +object+ matches this event. def match( object ) return super && object.respond_to?( :criteria ) && self.node.matches?( object.criteria ) end ### Inject the node identifier into the generated hash. def to_hash return super.merge( identifier: self.node.identifier ) end end # module Arborist::Event::NodeMatching
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arborist-0.0.1.pre20160128152542 | lib/arborist/event/node_matching.rb |