Sha256: 90e1d548b028ad465396f02234a2d1a7ab902c548826593195f88f7d03b8ffcc

Contents?: true

Size: 631 Bytes

Versions: 4

Compression:

Stored size: 631 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)

      assert_present! :it, it
      assert_present! :to, to
      assert_present! :at, at

      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

4 entries across 4 versions & 1 rubygems

Version Path
unidom-geo-2.0.1 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-2.0 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5.9 app/models/unidom/geo/concerns/as_locator.rb
unidom-geo-1.5.8 app/models/unidom/geo/concerns/as_locator.rb