Class: Missions::Events::Users

Inherits:
Omega::Server::Event show all
Defined in:
lib/missions/events/users.rb

Overview

An event this is spawed by another in the users subsystem

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, #json_data, #should_exec?, #time_elapsed?, #to_s

Constructor Details

#initialize(args = {}) ⇒ Users

Users Event intializer


20
21
22
23
24
25
26
# File 'lib/missions/events/users.rb', line 20

def initialize(args={})
  attr_from_args args, :users_event_args => []

  # users event should be the first arg
  event = @users_event_args.first
  super(args.merge({:id => event, :timestamp => Time.now}))
end

Instance Attribute Details

#users_event_argsObject Also known as: event_args

Array of args received pertaining to the users event


14
15
16
# File 'lib/missions/events/users.rb', line 14

def users_event_args
  @users_event_args
end

Instance Method Details

#to_json(*a) ⇒ Object

Convert event to json representation and return it


29
30
31
32
33
34
35
# File 'lib/missions/events/users.rb', line 29

def to_json(*a)
  {
    'json_class' => self.class.name,
    'data'       =>
      json_data.merge({:users_event_args => @users_event_args})
  }.to_json(*a)
end