Sha256: d376a222326be8a2ad00760e19239dcbe7bb0e1d7d69adc2309782f09c8043bf

Contents?: true

Size: 538 Bytes

Versions: 10

Compression:

Stored size: 538 Bytes

Contents

##
# As Locator 是为定位者或者定位程序提供的领域逻辑关注点。

module Unidom::Geo::Concerns::AsLocator

  extend ActiveSupport::Concern

  included do |includer|

    has_many :locatings, class_name: 'Unidom::Geo::Locating', as:     :locator
    has_many :locations, through:    :locatings,              source: :location

    def locate!(it, to: nil, at: Time.now)
      locatings.location_is(to).located_is(it).valid_at(now: at).alive.first_or_create! opened_at: at
    end

  end

  module ClassMethods
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
unidom-geo-1.5.7 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5.6 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5.5 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5.4 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5.3 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5.2 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5.1 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.4.5 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.4.4 app/models/unidom/geo/concerns/as_locator.rb