Method: XRBP::WebSocket::Command#initialize

Defined in:
lib/xrbp/websocket/command.rb

#initialize(data) ⇒ Command

Returns a new instance of Command.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/xrbp/websocket/command.rb', line 9

def initialize(data)
  @@id ||= 0
  @id = (@@id += 1)

  json = Hash[data]
  json['id'] = id

  @json = json

  super(json.to_json)
end