Class: Sol::OrdinalScale

Inherits:
Scale
  • Object
show all
Defined in:
lib/sol/scale.rb

Overview

Instance Attribute Summary

Attributes inherited from Scale

#spec, #type

Instance Method Summary collapse

Methods inherited from Scale

#initialize, #range

Constructor Details

This class inherits a constructor from Sol::Scale

Instance Method Details

#domain(values) ⇒ Object





194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/sol/scale.rb', line 194

def domain(values)

  # If the array has more than two elements then 'range' needs to have the same number 
  # of elements
  @elements = values.size

  scale = "["
  values.each_with_index do |value, i|
    scale << ", " if i > 0
    scale << "#{value}"
  end
  scale << "]"
  @spec << ".domain(#{scale})"

end