lib/terraformer/multi_polygon.rb in terraformer-0.0.6 vs lib/terraformer/multi_polygon.rb in terraformer-0.0.7

- old
+ new

@@ -2,16 +2,22 @@ class MultiPolygon < Geometry def initialize *args case + + # arg is an array of arrays of polygon, holes + when Array === args[0] && Array === args[0][0] && Array === args[0][0][0] && Array === args[0][0][0][0] + self.coordinates = Coordinate.from(*args) + when Coordinate === args[0] # only one self.coordinates = [[Coordinate.from_array(args)]] when Array === args[0] # multiple? self.coordinates = [Coordinate.from(args)] when Polygon === args[0] self.coordinates = args.map &:coordinates + else super *args end end @@ -24,13 +30,13 @@ end def == obj super obj do |o| equal = true - ps = polygons.sort - ops = o.polygons.sort + ps = polygons + ops = o.polygons ps.each_with_index do |p, i| - equal = p == ops[i] + equal = p == ops[i] rescue false break unless equal end equal end end