Class: Deribit::WS::BaseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/deribit/ws/base_handler.rb

Direct Known Subclasses

Handler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseHandler

Returns a new instance of BaseHandler.



6
7
8
# File 'lib/deribit/ws/base_handler.rb', line 6

def initialize
  update_timestamp
end

Instance Attribute Details

#timestampObject

Returns the value of attribute timestamp.



4
5
6
# File 'lib/deribit/ws/base_handler.rb', line 4

def timestamp
  @timestamp
end

#wsObject

Returns the value of attribute ws.



4
5
6
# File 'lib/deribit/ws/base_handler.rb', line 4

def ws
  @ws
end

Instance Method Details

#process(json, method: nil, ws: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/deribit/ws/base_handler.rb', line 10

def process(json, method: nil, ws: nil)
  @ws = ws

  if method && self.respond_to?(method)
    self.send(method, json)
  else
    puts "Received method #{method}: #{json}"
  end

  update_timestamp
end