<commit_before>module Neo4j::ActiveNode
  module Enum
    extend ActiveSupport::Concern
    include Neo4j::Shared::Enum

    module ClassMethods
      protected

      def define_property(property_name, *args)
        super
        Neo4j::ModelSchema.add_required_index(self, property_name)
      end

      def define_enum_methods(property_name, enum_keys, options)
        super
        define_enum_scopes(property_name, enum_keys)
      end

      def define_enum_scopes(property_name, enum_keys)
        enum_keys.keys.each do |name|
          scope name, -> { where(property_name => name) }
        end
      end
    end
  end
end
<commit_msg>Allow enums to be created without associated indexes<commit_after>module Neo4j::ActiveNode
  module Enum
    extend ActiveSupport::Concern
    include Neo4j::Shared::Enum

    module ClassMethods
      protected

      def define_property(property_name, *args)
        super
        Neo4j::ModelSchema.add_required_index(self, property_name) unless args[1][:_index] == false
      end

      def define_enum_methods(property_name, enum_keys, options)
        super
        define_enum_scopes(property_name, enum_keys)
      end

      def define_enum_scopes(property_name, enum_keys)
        enum_keys.keys.each do |name|
          scope name, -> { where(property_name => name) }
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.06944444444444445, 'fraction_numerical': 0.005116959064327485, 'mean_word_length': 2.8240223463687153, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4125499', 'n_tokens_mistral': 416, 'n_tokens_neox': 400, 'n_words': 92}