Class: Manufactured::Events::EntityDestroyed

Inherits:
Omega::Server::Event show all
Defined in:
lib/manufactured/events/entity_destroyed.rb

Constant Summary collapse

TYPE =
:entity_destroyed

Instance Attribute Summary collapse

Attributes inherited from Omega::Server::Event

#handlers, #id, #registry, #timestamp, #type

Instance Method Summary collapse

Methods inherited from Omega::Server::Event

#handlers_json, #invoke, json_create, #should_exec?, #time_elapsed?, #to_json, #to_s

Constructor Details

#initialize(args = {}) ⇒ EntityDestroyed

Entity Destroyed Event intializer


20
21
22
23
24
# File 'lib/manufactured/events/entity_destroyed.rb', line 20

def initialize(args={})
  attr_from_args args, :entity => nil
  id = "#{TYPE}-#{entity ? entity.id : nil}"
  super(:id => id, :type => TYPE.to_s)
end

Instance Attribute Details

#entityObject

Entity which was destroyed


15
16
17
# File 'lib/manufactured/events/entity_destroyed.rb', line 15

def entity
  @entity
end

Instance Method Details

#event_argsObject


26
27
28
# File 'lib/manufactured/events/entity_destroyed.rb', line 26

def event_args
  [entity]
end

#json_dataObject


37
38
39
# File 'lib/manufactured/events/entity_destroyed.rb', line 37

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

#trigger_handler?(handler) ⇒ Boolean

Assuming we're only getting Manufactured::EventHandler instances here


31
32
33
34
35
# File 'lib/manufactured/events/entity_destroyed.rb', line 31

def trigger_handler?(handler)
  # TODO right now always return true, should allow handler
  # to specify filters which to match entities with
  true
end