Class: Sol::LinearScale
Overview
Instance Attribute Summary
Attributes inherited from Scale
Instance Method Summary collapse
-
#domain(numbers) ⇒ Object
————————————————————————————.
-
#initialize ⇒ LinearScale
constructor
————————————————————————————.
Methods inherited from Scale
Constructor Details
#initialize ⇒ LinearScale
155 156 157 |
# File 'lib/sol/scale.rb', line 155 def initialize super("linear") end |
Instance Method Details
#domain(numbers) ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/sol/scale.rb', line 163 def domain(numbers) # If the array has more than two elements then 'range' needs to have the same number # of elements @elements = numbers.size scale = "[" numbers.each_with_index do |num, i| if (!num.is_a? Numeric) raise "Linear domain values should all be numbers. Invalid: #{num}" end scale << ", " if i > 0 scale << "#{num}" end scale << "]" @spec << ".domain(#{scale})" end |