Class: OnsOpenApi::Value

Inherits:
Object
  • Object
show all
Includes:
Morph
Defined in:
lib/ons_openapi/value.rb

Instance Method Summary collapse

Instance Method Details

#labelled_values(dimension) ⇒ Object



10
11
12
13
14
15
# File 'lib/ons_openapi/value.rb', line 10

def labelled_values dimension
  labels = dimension.labels
  list = []
  values.each_with_index {|v,i| list << [labels[i], v]}
  list
end

#valuesObject



5
6
7
8
# File 'lib/ons_openapi/value.rb', line 5

def values
  keys = methods.select{|x| x[/^_\d+$/]}
  keys.each_with_object([]) {|k,a| index = Integer(k.to_s.sub('_','')) ; a[index] = send(k) }
end