<commit_before>require 'lotus/utils/class_attribute'

module Lotus
  module Model
    module Entity
      def self.included(base)
        base.class_eval do
          extend  ClassMethods
          include Utils::ClassAttribute

          class_attribute :primary_key
          self.primary_key = :id
        end
      end

      module ClassMethods
        def attributes=(*attributes)
          @attributes = attributes
          @attributes.flatten!

          class_eval %{
            def initialize(attributes = {})
              #{ attributes.map {|a| "@#{a}" }.join(', ') },_ = *attributes.values_at(#{ attributes.map {|a| ":#{a}"}.join(', ') })
            end
          }

          ([primary_key] + attributes).each do |attr|
            class_eval do
              attr_accessor attr
            end
          end
        end

        def attributes
          @attributes
        end
      end
    end
  end
end
<commit_msg>When generate Entity#initialize use class attribute 'attributes', instead of the homonym argument<commit_after>require 'lotus/utils/class_attribute'

module Lotus
  module Model
    module Entity
      def self.included(base)
        base.class_eval do
          extend  ClassMethods
          include Utils::ClassAttribute

          class_attribute :primary_key
          self.primary_key = :id
        end
      end

      module ClassMethods
        def attributes=(*attributes)
          @attributes = attributes
          @attributes.flatten!

          class_eval %{
            def initialize(attributes = {})
              #{ self.attributes.map {|a| "@#{a}" }.join(', ') },_ = *attributes.values_at(#{ self.attributes.map {|a| ":#{a}"}.join(', ') })
            end
          }

          ([primary_key] + attributes).each do |attr|
            class_eval do
              attr_accessor attr
            end
          end
        end

        def attributes
          @attributes
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.0935910478128179, 'fraction_numerical': 0.0, 'mean_word_length': 1.665311653116531, 'pattern_counts': {'":': 2, '<': 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': '1748466', 'n_tokens_mistral': 523, 'n_tokens_neox': 514, 'n_words': 131}