<commit_before>module SpreeeedEngine
  module Concerns
    module Generators
      class ModelGenerator < Rails::Generators::NamedBase
      
        desc <<-DESC.strip_heredoc
          Generate spreeeed_engine active_record extend attributes

          For example:
            rails generate spreeeed_engine:concerns:model NAME

            This will create:
              app/models/concerns/spreeeed_engine/models/NAME.rb

            real world case:
              rails g spreeeed_engine:concerns:model Manuscript::Photo

            then you can find file in 
              app/models/concerns/spreeeed_engine/models/manuscript/photo.rb

        DESC

        source_root File.expand_path('../templates', __FILE__)

        def create_concern_model
          @klass       = name.titleize.classify.constantize
          model_name   = name.titleize.singularize.downcase
          @namespaces  = model_name.split('/')
          @indent      = '  ' * (@namespaces.size + 2)
          @methods     = [:displayable_attrs, :editable_attrs, :hidden_attrs]
          template 'model.rb',
                   "app/models/concerns/spreeeed_engine/models/#{model_name}.rb"
        end

        def create_concern_datatable
          @klass       = name.titleize.classify.constantize
          model_name   = name.titleize.singularize.downcase
          @namespaces  = model_name.split('/')
          @indent      = '  ' * (@namespaces.size + 2)
          @methods     = [:datatable_cols, :datatable_searchable_cols, :datatable_sortable_cols, :datatable_default_sortable_cols]
          template 'datatable.rb',
                   "app/models/concerns/spreeeed_engine/datatables/#{model_name}.rb"
        end

      end
    end
  end
end

<commit_msg>generate spreeeed_engine concerns files<commit_after>module SpreeeedEngine
  module Concerns
    module Generators
      class ConcernsGenerator < Rails::Generators::NamedBase
      
        desc <<-DESC.strip_heredoc
          Generate spreeeed_engine active_record extend attributes

          For example:
            rails generate spreeeed_engine:concerns:model NAME

            This will create:
              app/models/concerns/spreeeed_engine/models/NAME.rb

            real world case:
              rails g spreeeed_engine:concerns:model Manuscript::Photo

            then you can find file in 
              app/models/concerns/spreeeed_engine/models/manuscript/photo.rb

        DESC

        source_root File.expand_path('../templates', __FILE__)

        def create_concern_model
          @klass       = name.titleize.classify.constantize
          model_name   = name.titleize.singularize.downcase
          @namespaces  = model_name.split('/')
          @indent      = '  ' * (@namespaces.size + 2)
          @methods     = [:displayable_attrs, :editable_attrs, :hidden_attrs]
          template 'model.rb',
                   "app/models/concerns/spreeeed_engine/models/#{model_name}.rb"
        end

        def create_concern_datatable
          @klass       = name.titleize.classify.constantize
          model_name   = name.titleize.singularize.downcase
          @namespaces  = model_name.split('/')
          @indent      = '  ' * (@namespaces.size + 2)
          @methods     = [:datatable_cols, :datatable_searchable_cols, :datatable_sortable_cols, :datatable_default_sortable_cols]
          template 'datatable.rb',
                   "app/models/concerns/spreeeed_engine/datatables/#{model_name}.rb"
        end

      end
    end
  end
end


{'fraction_non_alphanumeric': 0.08349900596421471, 'fraction_numerical': 0.001136040897472309, 'mean_word_length': 2.127886323268206, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3631637', 'n_tokens_mistral': 1047, 'n_tokens_neox': 998, 'n_words': 177}