Class: Users::Events::RegisteredUser

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

Overview

Spawned by the local users subsystem

Constant Summary collapse

TYPE =
:registered_user

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 = {}) ⇒ RegisteredUser

RegisteredUser Event intializer


19
20
21
22
23
# File 'lib/users/events/registered_user.rb', line 19

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

Instance Attribute Details

#userObject

Handle to user that was registered


16
17
18
# File 'lib/users/events/registered_user.rb', line 16

def user
  @user
end

Instance Method Details

#event_argsObject


25
26
27
# File 'lib/users/events/registered_user.rb', line 25

def event_args
  [user]
end

#to_json(*a) ⇒ Object

Convert event to json representation and return it


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

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