Class: Schedule
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#local_time ⇒ Object
readonly
Returns the value of attribute local_time.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(id, data = {}) ⇒ Schedule
constructor
A new instance of Schedule.
- #scene ⇒ Object
Methods inherited from HObject
Constructor Details
#initialize(id, data = {}) ⇒ Schedule
Returns a new instance of Schedule.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lights/schedule.rb', line 8 def initialize(id,data = {}) @id = id @name = data["name"] @time = data["time"] @status = data["status"] @description = data["description"] @local_time = data["localtime"] @created = data["created"] @command = Command.new(data["command"]) end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/lights/schedule.rb', line 5 def command @command end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
5 6 7 |
# File 'lib/lights/schedule.rb', line 5 def created @created end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/lights/schedule.rb', line 5 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/lights/schedule.rb', line 5 def id @id end |
#local_time ⇒ Object (readonly)
Returns the value of attribute local_time.
5 6 7 |
# File 'lib/lights/schedule.rb', line 5 def local_time @local_time end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/lights/schedule.rb', line 5 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/lights/schedule.rb', line 5 def status @status end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
5 6 7 |
# File 'lib/lights/schedule.rb', line 5 def time @time end |
Instance Method Details
#data ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/lights/schedule.rb', line 23 def data data = {} data["name"] = @name if @name data["time"] = @time if @time data["status"] = @status if @status data["description"] = @description if @description data["localtime"] = @local_time if @local_time data["created"] = @created if @created data["command"] = @command.data unless @command.data.empty? data end |
#scene ⇒ Object
19 20 21 |
# File 'lib/lights/schedule.rb', line 19 def scene @command.body["scene"] end |