Class: Kameleoon::Configuration::Variable
- Inherits:
-
Object
- Object
- Kameleoon::Configuration::Variable
- Defined in:
- lib/kameleoon/configuration/variable.rb
Overview
Variable class contains key / type / value of variable
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #get_value ⇒ Object
-
#initialize(hash) ⇒ Variable
constructor
A new instance of Variable.
Constructor Details
#initialize(hash) ⇒ Variable
Returns a new instance of Variable.
14 15 16 17 18 |
# File 'lib/kameleoon/configuration/variable.rb', line 14 def initialize(hash) @key = hash['key'] @type = hash['type'] @value = hash['value'] end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
8 9 10 |
# File 'lib/kameleoon/configuration/variable.rb', line 8 def key @key end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/kameleoon/configuration/variable.rb', line 8 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/kameleoon/configuration/variable.rb', line 8 def value @value end |
Class Method Details
Instance Method Details
#get_value ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kameleoon/configuration/variable.rb', line 20 def get_value case @type when 'BOOLEAN', 'STRING', 'NUMBER', 'JS', 'CSS' @value when 'JSON' JSON.parse(@value) else Logging::KameleoonLogger.error("Unknown type '#{@type}' for feature variable") @value end end |