Class: SCB::DB::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/scb/db/variable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (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

#codeObject



12
13
14
# File 'lib/scb/db/variable.rb', line 12

def code
  data["code"]
end

#elimination?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/scb/db/variable.rb', line 32

def elimination?
  !!data["elimination"]
end

#textObject



16
17
18
# File 'lib/scb/db/variable.rb', line 16

def text
  data["text"]
end

#time?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/scb/db/variable.rb', line 36

def time?
  !!data["time"]
end

#value_textsObject



28
29
30
# File 'lib/scb/db/variable.rb', line 28

def value_texts
  data["valueTexts"]
end

#valuesObject



20
21
22
# File 'lib/scb/db/variable.rb', line 20

def values
  data["values"]
end

#values_hashObject



24
25
26
# File 'lib/scb/db/variable.rb', line 24

def values_hash
  @values_hash ||= Hash[values.zip(value_texts)]
end