Sha256: 3eb02f457976d611a239635875bb3a7364d5b499086c164253613c6783928f20

Contents?: true

Size: 339 Bytes

Versions: 5

Compression:

Stored size: 339 Bytes

Contents

# frozen_string_literal: true

class LatLng
  attr_accessor :lat, :lng

  def self.demongoize(object)
    return if object.nil?

    LatLng.new(object[1], object[0])
  end

  def initialize(lat, lng)
    @lat, @lng = lat, lng
  end

  def mongoize
    [ lng, lat ]
  end

  def ==(other)
    lat == other.lat && lng == other.lng
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongoid-8.1.10 spec/support/models/lat_lng.rb
mongoid-8.1.9 spec/support/models/lat_lng.rb
mongoid-8.1.8 spec/support/models/lat_lng.rb
mongoid-8.1.7 spec/support/models/lat_lng.rb
mongoid-8.1.6 spec/support/models/lat_lng.rb