<commit_before>module ActsAsSeen
  module ViewerMethods
    module ClassMethods
      protected
      def read_acts_as_viewer_options(opts)
        raise ArgumentError unless opts[:of]
        write_inheritable_attribute :observed_model_name, opts[:of].to_s
        write_inheritable_attribute :observed_model_klass, self.observed_model_name.classify.constantize
      end

      def declare_acts_as_viewer_relationships
        has_many :sights, :class_name => @sightable_name, :foreign_key => "viewer_id"
      end
    end

    module InstanceMethods
      def saw(object)
        raise ArgumentError.new("#{object.class} is not sightable by #{self.class.name}") unless object_is_sightable? object
        #sights.create(:sightable => object)
        update_or_create_sight(:sightable_id => object.id, :sightable_type => object.class.to_s)
      end

      def sightable?(object)
        object_is_sightable(object) || class_is_sightable(object)
      end

      def object_is_sightable?(object)
        object.class == self.observed_model_klass
      end

      def class_is_sightable?(klass)
        klass == self.observed_model_klass
      end
    end
    
    def self.included(receiver)
      receiver.extend         ClassMethods
      receiver.send :include, InstanceMethods
    end
  end
end<commit_msg>removed some old wrong code that luckily had no effect<commit_after>module ActsAsSeen
  module ViewerMethods
    module ClassMethods
      protected
      def read_acts_as_viewer_options(opts)
        raise ArgumentError unless opts[:of]
        write_inheritable_attribute :observed_model_name, opts[:of].to_s
        write_inheritable_attribute :observed_model_klass, self.observed_model_name.classify.constantize
      end

      def declare_acts_as_viewer_relationships
        has_many :sights, :foreign_key => "viewer_id"
      end
    end

    module InstanceMethods
      def saw(object)
        raise ArgumentError.new("#{object.class} is not sightable by #{self.class.name}") unless object_is_sightable? object
        #sights.create(:sightable => object)
        update_or_create_sight(:sightable_id => object.id, :sightable_type => object.class.to_s)
      end

      def sightable?(object)
        object_is_sightable(object) || class_is_sightable(object)
      end

      def object_is_sightable?(object)
        object.class == self.observed_model_klass
      end

      def class_is_sightable?(klass)
        klass == self.observed_model_klass
      end
    end
    
    def self.included(receiver)
      receiver.extend         ClassMethods
      receiver.send :include, InstanceMethods
    end
  end
end
{'fraction_non_alphanumeric': 0.07102164830991264, 'fraction_numerical': 0.0, 'mean_word_length': 3.0964230171073095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '5134537', 'n_tokens_mistral': 805, 'n_tokens_neox': 784, 'n_words': 160}