Class: GrowthForecast::Complex::Item
- Inherits:
-
Object
- Object
- GrowthForecast::Complex::Item
- Defined in:
- lib/growthforecast/complex.rb
Instance Attribute Summary collapse
-
#gmode ⇒ Object
Returns the value of attribute gmode.
-
#graph_id ⇒ Object
Returns the value of attribute graph_id.
-
#stack ⇒ Object
Returns the value of attribute stack.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(obj) ⇒ Item
constructor
A new instance of Item.
- #to_hash ⇒ Object
Constructor Details
#initialize(obj) ⇒ Item
Returns a new instance of Item.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/growthforecast/complex.rb', line 57 def initialize(obj) if obj.is_a?(String) obj = JSON.parse(obj) end obj.keys.each do |k| obj[k.to_sym] = obj.delete(k) end @graph_id = obj[:graph_id] @gmode = obj[:gmode] || 'gauge' @stack = (obj[:stack] || obj[:stack].nil?) ? true : false @type = obj[:type] || 'AREA' end |
Instance Attribute Details
#gmode ⇒ Object
Returns the value of attribute gmode.
55 56 57 |
# File 'lib/growthforecast/complex.rb', line 55 def gmode @gmode end |
#graph_id ⇒ Object
Returns the value of attribute graph_id.
55 56 57 |
# File 'lib/growthforecast/complex.rb', line 55 def graph_id @graph_id end |
#stack ⇒ Object
Returns the value of attribute stack.
55 56 57 |
# File 'lib/growthforecast/complex.rb', line 55 def stack @stack end |
#type ⇒ Object
Returns the value of attribute type.
55 56 57 |
# File 'lib/growthforecast/complex.rb', line 55 def type @type end |
Instance Method Details
#to_hash ⇒ Object
71 72 73 |
# File 'lib/growthforecast/complex.rb', line 71 def to_hash {'graph_id' => @graph_id, 'gmode' => @gmode, 'stack' => @stack, 'type' => @type} end |