class Orator::Client
A representation of a client.
Attributes
context[RW]
The context to be used by the client.
@return [Object]
event_handler[RW]
The event handler for this client.
@return [EventHandler]
socket[RW]
The socket to be used to talk to the client.
@return [#send]
Public Class Methods
new(data)
click to toggle source
Initialize.
@param data [Hash] the keys are used to set data on the client to the
values of the hash. If the attribute doesn't exist on the client, it is ignored.
@example
client = Client.new :something => "foo" client.something # => "foo"
# File lib/orator/client.rb, line 29 def initialize(data) data.each do |k, v| send "#{k}=", v if respond_to? "#{k}=" end end
Public Instance Methods
to_hash()
click to toggle source
This is here just in case anyone gets the bright idea to serialize the client with Oj. This should not happen, because it could reveal information that you may not want to be revealed.
@return [Hash]
# File lib/orator/client.rb, line 48 def to_hash context.table end
trigger(event, *args)
click to toggle source
This forwards the method call to [EventHandler#trigger], but removes an argument: the context.
@see [EventHandler#trigger]
# File lib/orator/client.rb, line 39 def trigger(event, *args) event_handler.trigger(event, context, *args) end