lib/perfect_shape/multi_point.rb in perfect-shape-0.3.3 vs lib/perfect_shape/multi_point.rb in perfect-shape-0.3.4
- old
+ new
@@ -35,10 +35,16 @@
unless the_points.first.is_a?(Array)
xs = the_points.each_with_index.select {|n, i| i.even?}.map(&:first)
ys = the_points.each_with_index.select {|n, i| i.odd?}.map(&:first)
the_points = xs.zip(ys)
end
- @points = the_points.map {|pair| [BigDecimal(pair.first.to_s), BigDecimal(pair.last.to_s)]}
+ @points = the_points.map do |pair|
+ [
+ pair.first.is_a?(BigDecimal) ? pair.first : BigDecimal(pair.first.to_s),
+ pair.last.is_a?(BigDecimal) ? pair.last : BigDecimal(pair.last.to_s)
+ ]
+ end
+ @points
end
def min_x
points.map(&:first).min
end