Class: Peatio::MQ::Events::Client
- Inherits:
-
Object
- Object
- Peatio::MQ::Events::Client
- Defined in:
- lib/peatio/mq/events.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#authorized ⇒ Object
Returns the value of attribute authorized.
-
#streams ⇒ Object
Returns the value of attribute streams.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(socket, streams = {}) ⇒ Client
constructor
A new instance of Client.
- #send_payload(message) ⇒ Object
Constructor Details
#initialize(socket, streams = {}) ⇒ Client
Returns a new instance of Client.
38 39 40 41 42 43 44 45 46 |
# File 'lib/peatio/mq/events.rb', line 38 def initialize(socket, streams = {}) @socket = socket @streams = streams @user = "" @authorized = false @@all << self end |
Instance Attribute Details
#authorized ⇒ Object
Returns the value of attribute authorized.
22 23 24 |
# File 'lib/peatio/mq/events.rb', line 22 def @authorized end |
#streams ⇒ Object
Returns the value of attribute streams.
22 23 24 |
# File 'lib/peatio/mq/events.rb', line 22 def streams @streams end |
#user ⇒ Object
Returns the value of attribute user.
22 23 24 |
# File 'lib/peatio/mq/events.rb', line 22 def user @user end |
Class Method Details
.all ⇒ Object
26 27 28 |
# File 'lib/peatio/mq/events.rb', line 26 def self.all @@all end |
.user(user) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/peatio/mq/events.rb', line 30 def self.user(user) @@all.each do |handler| if handler.user == user yield handler end end end |
Instance Method Details
#send_payload(message) ⇒ Object
48 49 50 |
# File 'lib/peatio/mq/events.rb', line 48 def send_payload() @socket.send .to_json end |