lib/tmx/map.rb
def export_to_string(options = {})
      hash = self.to_h

      # Need to add back all non-tilelayers to hash["layers"]
      image_layers = hash.delete(:image_layers)
      object_groups = hash.delete(:object_groups)
      hash[:layers] += image_layers
      hash[:layers] += object_groups
      hash[:layers].sort_by! { |l| l[:name] }
      hash.delete(:contents)

      object_groups.each do |object_layer|
        object_layer["objects"].each do |object|
          # If present, "shape" and "points" should be removed
          object.delete("shape")
          object.delete("points")
        end
      end

      MultiJson.dump(hash)
    end
def export_to_string(options = {})
      hash = self.to_h

      # Need to add back all non-tilelayers to hash["layers"]
      image_layers = hash.delete(:image_layers)
      object_groups = hash.delete(:object_groups)
      hash[:layers] += image_layers
      hash[:layers] += object_groups
      hash[:layers].sort_by! { |l| l[:name] }
      hash.delete(:contents)

      object_groups.each do |object_layer|
        object_layer["objects"].each do |object|
          # If present, "shape" and "points" should be removed
          object.delete("shape")
          object.delete("points")
        end
      end

      MultiJson.dump(hash)
    end
Export this map as a string in the appropriate format.

 @param options [Hash] Options for exporting
 @option options [Symbol,String] :format The format to export to, such as :tmx or :json
 @option options [String] :filename The eventual filename, which gives a relative path for linked TSX files
 @return [String] The exported content in the appropriate format