Skip to content

Commit

Permalink
use ActiveSupport::Concern
Browse files Browse the repository at this point in the history
  • Loading branch information
msimonborg committed Jul 14, 2017
1 parent c983c2f commit e9cf3bd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/models/concerns/geographic.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# frozen_string_literal: true

module Geographic
extend ActiveSupport::Concern

FACTORY = RGeo::Geographic.simple_mercator_factory
EWKB = RGeo::WKRep::WKBGenerator.new(
type_format: :ewkb,
emit_ewkb_srid: true,
hex_format: true
)

def self.included(base)
base.extend(ClassMethods)
end

module ClassMethods
class_methods do
def containing_latlon(lat, lon)
point = FACTORY.point(lon, lat)
containing_point(point)
Expand Down

0 comments on commit e9cf3bd

Please sign in to comment.