Class: SCB::DB::Variable
- Inherits:
-
Object
- Object
- SCB::DB::Variable
- Defined in:
- lib/scb/db/variable.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #code ⇒ Object
- #elimination? ⇒ Boolean
-
#initialize(data) ⇒ Variable
constructor
A new instance of Variable.
- #text ⇒ Object
- #time? ⇒ Boolean
- #value_texts ⇒ Object
- #values ⇒ Object
- #values_hash ⇒ Object
Constructor Details
#initialize(data) ⇒ Variable
Returns a new instance of Variable.
8 9 10 |
# File 'lib/scb/db/variable.rb', line 8 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/scb/db/variable.rb', line 6 def data @data end |
Instance Method Details
#code ⇒ Object
12 13 14 |
# File 'lib/scb/db/variable.rb', line 12 def code data["code"] end |
#elimination? ⇒ Boolean
32 33 34 |
# File 'lib/scb/db/variable.rb', line 32 def elimination? !!data["elimination"] end |
#text ⇒ Object
16 17 18 |
# File 'lib/scb/db/variable.rb', line 16 def text data["text"] end |
#time? ⇒ Boolean
36 37 38 |
# File 'lib/scb/db/variable.rb', line 36 def time? !!data["time"] end |
#value_texts ⇒ Object
28 29 30 |
# File 'lib/scb/db/variable.rb', line 28 def value_texts data["valueTexts"] end |
#values ⇒ Object
20 21 22 |
# File 'lib/scb/db/variable.rb', line 20 def values data["values"] end |
#values_hash ⇒ Object
24 25 26 |
# File 'lib/scb/db/variable.rb', line 24 def values_hash @values_hash ||= Hash[values.zip(value_texts)] end |