Class: Command

Inherits:
HObject show all
Defined in:
lib/lights/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HObject

#to_json

Constructor Details

#initialize(data = {}) ⇒ Command

Returns a new instance of Command.



5
6
7
8
9
# File 'lib/lights/command.rb', line 5

def initialize(data = {})
  @address = data["address"]
  @body = data["body"]
  @method = data["method"]
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



4
5
6
# File 'lib/lights/command.rb', line 4

def address
  @address
end

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/lights/command.rb', line 4

def body
  @body
end

#methodObject (readonly)

Returns the value of attribute method.



4
5
6
# File 'lib/lights/command.rb', line 4

def method
  @method
end

Instance Method Details

#dataObject



11
12
13
14
15
16
17
# File 'lib/lights/command.rb', line 11

def data
  data = {}
  data["address"] = @address if @address
  data["body"] = @body if @body
  data["method"] = @method if @method
  data
end