<commit_before>require 'spyke/collection'
require 'spyke/attributes'

module Spyke
  module AttributeAssignment
    extend ActiveSupport::Concern

    included do
      attr_reader :attributes
      delegate :[], :[]=, to: :attributes
    end

    module ClassMethods
      # By adding instance methods via an included module,
      # they become overridable with "super".
      # http://thepugautomatic.com/2013/07/dsom/
      def attributes(*names)
        unless instance_variable_defined?(:@spyke_instance_method_container)
          @spyke_instance_method_container = Module.new
          include @spyke_instance_method_container
        end

        @spyke_instance_method_container.module_eval do
          names.each do |name|
            define_method(name) do
              attribute(name)
            end

            define_method(:"#{name}=") do |value|
              set_attribute(name, value)
            end
          end
        end
      end
    end

    def initialize(attributes = {})
      self.attributes = attributes
      @uri_template = scope.uri
      yield self if block_given?
    end

    def attributes=(new_attributes)
      @attributes ||= Attributes.new(scope.params)
      use_setters(new_attributes) if new_attributes
    end

    def id?
      id.present?<commit_msg>Use @spyke_attributes instead of @attributes instance var<commit_after>require 'spyke/collection'
require 'spyke/attributes'

module Spyke
  module AttributeAssignment
    extend ActiveSupport::Concern

    included do
      delegate :[], :[]=, to: :attributes
    end

    module ClassMethods
      # By adding instance methods via an included module,
      # they become overridable with "super".
      # http://thepugautomatic.com/2013/07/dsom/
      def attributes(*names)
        unless instance_variable_defined?(:@spyke_instance_method_container)
          @spyke_instance_method_container = Module.new
          include @spyke_instance_method_container
        end

        @spyke_instance_method_container.module_eval do
          names.each do |name|
            define_method(name) do
              attribute(name)
            end

            define_method(:"#{name}=") do |value|
              set_attribute(name, value)
            end
          end
        end
      end
    end

    def initialize(attributes = {})
      self.attributes = attributes
      @uri_template = scope.uri
      yield self if block_given?
    end

    def attributes
      @spyke_attributes
    end

    def attributes=(new_attributes)
      @spyke_attributes ||= Attributes.new(scope.params)
      use_setters(new_attributes) if new_attributes
    end

    def id?
      id.present?
{'fraction_non_alphanumeric': 0.07542942494398805, 'fraction_numerical': 0.004480955937266617, 'mean_word_length': 2.3740554156171285, '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': '6592401', 'n_tokens_mistral': 762, 'n_tokens_neox': 738, 'n_words': 175}