Sha256: efcf7e76319f8c829fc823f34849689769d86298127a9474a6f5ddaeba1aec53

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

module Clumpy
  class Bounds
    def initialize(latitude, longitude, width, length)
      l = length / 2
      w = width / 2
      @latitude  = (latitude - l)..(latitude + l)
      @longitude = (longitude - w)..(longitude + w)
    end

    attr_reader :latitude

    attr_reader :longitude

    def as_json(*)
      {
        northeast: {
          latitude: @latitude.end,
          longitude: @longitude.end,
        },
        southwest: {
          latitude: @latitude.begin,
          longitude: @longitude.begin,
        }
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clumpy-1.1.0 lib/clumpy/bounds.rb