<commit_before>##
# As Located 是为地标提供的领域逻辑关注点。

module Unidom::Geo::Concerns::AsLocated

  extend ActiveSupport::Concern

  included do |includer|

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

    ##
    # 将地标与位置关联起来。如：
    # location = Unidom::Geo::Location.first
    # shop.is_located! to: location, by: current_person
    def is_located!(to: nil, by: nil, at: Time.now)
      locatings.location_is(to).valid_at(now: at).alive.first_or_create! locator: by, opened_at: at
    end

    def is_located?(to: nil, at: Time.now)
      locatings.location_is(to).valid_at(now: at).alive.exists?
    end

  end

  module ClassMethods
  end

end<commit_msg>1, Improve the As Located concern for the document.<commit_after>##
# As Located 是为地标提供的领域逻辑关注点。

module Unidom::Geo::Concerns::AsLocated

  extend ActiveSupport::Concern

  included do |includer|

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

    ##
    # 将当前位置与地标 to 关联起来。如：
    # location = Unidom::Geo::Location.first
    # shop.is_located! to: location, by: current_person
    def is_located!(to: nil, by: nil, at: Time.now)
      locatings.location_is(to).valid_at(now: at).alive.first_or_create! locator: by, opened_at: at
    end

    def is_located?(to: nil, at: Time.now)
      locatings.location_is(to).valid_at(now: at).alive.exists?
    end

  end

  module ClassMethods
  end

end
{'fraction_non_alphanumeric': 0.11959287531806616, 'fraction_numerical': 0.0006361323155216285, 'mean_word_length': 3.572674418604651, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2391650', 'n_tokens_mistral': 624, 'n_tokens_neox': 606, 'n_words': 125}