Class: Missions::EventHandlers::ManufacturedEventHandler

Inherits:
Omega::Server::EventHandler show all
Defined in:
lib/missions/event_handler.rb

Overview

Manufactured Event Handler, allows clients to match Manufactured Events via custom filters

Instance Attribute Summary collapse

Attributes inherited from Omega::Server::EventHandler

#endpoint_id, #event_id, #event_type, #handlers, #persist

Instance Method Summary collapse

Methods inherited from Omega::Server::EventHandler

#exec, #handlers_json, #invoke, json_create, #to_json

Constructor Details

#initialize(args = {}) ⇒ ManufacturedEventHandler

Returns a new instance of ManufacturedEventHandler


87
88
89
90
# File 'lib/missions/event_handler.rb', line 87

def initialize(args = {})
  attr_from_args args, :manu_event_type => nil
  super(args)
end

Instance Attribute Details

#manu_event_typeObject

Manufactured event type to match


85
86
87
# File 'lib/missions/event_handler.rb', line 85

def manu_event_type
  @manu_event_type
end

Instance Method Details

#json_dataObject


98
99
100
# File 'lib/missions/event_handler.rb', line 98

def json_data
  super.merge({ :manu_event_type => manu_event_type })
end

#matches?(manu_event) ⇒ Boolean

Returns:

  • (Boolean)

92
93
94
95
96
# File 'lib/missions/event_handler.rb', line 92

def matches?(manu_event)
   manu_event.kind_of?(Missions::Events::Manufactured) &&
  (manu_event_type.nil? || manu_event_type == manu_event.manu_event_type) &&
  super(manu_event)
end