<commit_before>module Rails
  module Angulate
    module Helpers
      module Tags
        module TagCommon
          extend ActiveSupport::Concern
          include Forwardable

          protected

          delegate :configuration, to: Rails::Angulate

          def angular_form_object_name
            @template_object.ng_form_name(object)
          end

          def angular_form_field_object_name
            @template_object.ng_form_field_name(object, @method_name)
          end

          def validators
            @validators ||=
              object.class.validators.select { |v| v.attributes.include?(@method_name.to_sym) }
          end

          def add_ng_validation_attrs(attrs)
            validators.each do |validator|
              attrs.reverse_merge!(validator_mapper_for(validator).ng_attributes)
            end
          end

          def validator_mapper_for(validator)
            Rails::Angulate::Mappers.create_validator_mapper_for(object, @method_name, validator)
          end

          def add_ng_options(options)
            if options.has_key?("ng")
              options.delete("ng").each do |k, v|
                options["ng-#{k}"] = v
              end
            end
          end

          def add_ng_model(options)
            unless options.has_key?("ng-model")
              options["ng-model"] = options.fetch("ngModel") do
                ng_model_name(options["id"])
              end.to_s
            end
          end

          def ng_model_name(id)
            id.camelize(:lower)
          end

          def self.field_type
            @field_type ||= super.sub(/^ng/, '')
          end
        end
      end
    end
  end
end<commit_msg>Should be method in ClassMethod module<commit_after>module Rails
  module Angulate
    module Helpers
      module Tags
        module TagCommon
          extend ActiveSupport::Concern
          include Forwardable

          protected

          delegate :configuration, to: Rails::Angulate

          def angular_form_object_name
            @template_object.ng_form_name(object)
          end

          def angular_form_field_object_name
            @template_object.ng_form_field_name(object, @method_name)
          end

          def validators
            @validators ||=
              object.class.validators.select { |v| v.attributes.include?(@method_name.to_sym) }
          end

          def add_ng_validation_attrs(attrs)
            validators.each do |validator|
              attrs.reverse_merge!(validator_mapper_for(validator).ng_attributes)
            end
          end

          def validator_mapper_for(validator)
            Rails::Angulate::Mappers.create_validator_mapper_for(object, @method_name, validator)
          end

          def add_ng_options(options)
            if options.has_key?("ng")
              options.delete("ng").each do |k, v|
                options["ng-#{k}"] = v
              end
            end
          end

          def add_ng_model(options)
            unless options.has_key?("ng-model")
              options["ng-model"] = options.fetch("ngModel") do
                ng_model_name(options["id"])
              end.to_s
            end
          end

          def ng_model_name(id)
            id.camelize(:lower)
          end

          module ClassMethods
            def field_type
              @field_type ||= super.sub(/^ng/, '')
            end
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07761107905366417, 'fraction_numerical': 0.0, 'mean_word_length': 1.5989505247376312, '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': '2881037', 'n_tokens_mistral': 957, 'n_tokens_neox': 936, 'n_words': 181}