Class: Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/lights/rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id = nil, data = {}) ⇒ Rule

Returns a new instance of Rule.



4
5
6
7
8
# File 'lib/lights/rule.rb', line 4

def initialize( id = nil, data = {} )
  @id = id
  @data = data
  @name = data["name"]
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/lights/rule.rb', line 3

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/lights/rule.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/lights/rule.rb', line 3

def name
  @name
end

Instance Method Details

#to_json(options = {}) ⇒ Object



16
17
18
# File 'lib/lights/rule.rb', line 16

def to_json(options={})
  data.to_json
end