Class: Sunniesnow::Event
- Inherits:
-
Object
- Object
- Sunniesnow::Event
- Defined in:
- lib/sscharter/chart.rb
Instance Attribute Summary collapse
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#time ⇒ Object
Returns the value of attribute time.
-
#time_dependent ⇒ Object
Returns the value of attribute time_dependent.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(time, type, **properties) ⇒ Event
constructor
A new instance of Event.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(time, type, **properties) ⇒ Event
Returns a new instance of Event.
124 125 126 127 128 |
# File 'lib/sscharter/chart.rb', line 124 def initialize time, type, **properties @time = time @type = type @properties = properties end |
Instance Attribute Details
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
122 123 124 |
# File 'lib/sscharter/chart.rb', line 122 def properties @properties end |
#time ⇒ Object
Returns the value of attribute time.
121 122 123 |
# File 'lib/sscharter/chart.rb', line 121 def time @time end |
#time_dependent ⇒ Object
Returns the value of attribute time_dependent.
121 122 123 |
# File 'lib/sscharter/chart.rb', line 121 def time_dependent @time_dependent end |
#type ⇒ Object
Returns the value of attribute type.
121 122 123 |
# File 'lib/sscharter/chart.rb', line 121 def type @type end |
Instance Method Details
#[](key) ⇒ Object
130 131 132 |
# File 'lib/sscharter/chart.rb', line 130 def [] key @properties[key] end |
#[]=(key, value) ⇒ Object
134 135 136 |
# File 'lib/sscharter/chart.rb', line 134 def []= key, value @properties[key] = value end |
#to_json(*args) ⇒ Object
138 139 140 141 142 |
# File 'lib/sscharter/chart.rb', line 138 def to_json *args result = {time: @time, type: @type, properties: @properties} result[:timeDependent] = @time_dependent if @time_dependent result.to_json *args end |