Sha256: ee345847080374010a96e2964756cee44aed5301e41b2de2044a5dbc33b1a78c

Contents?: true

Size: 653 Bytes

Versions: 18

Compression:

Stored size: 653 Bytes

Contents

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.each_key do |name|
          scope name, -> { where(property_name => name) }
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
neo4j-9.6.2 lib/neo4j/active_node/enum.rb
activegraph-10.0.0.pre.alpha.11 lib/neo4j/active_node/enum.rb
activegraph-10.0.0.pre.alpha.10 lib/neo4j/active_node/enum.rb
activegraph-10.0.0.pre.alpha.9 lib/neo4j/active_node/enum.rb
activegraph-10.0.0.pre.alpha.8 lib/neo4j/active_node/enum.rb
activegraph-10.0.0.pre.alpha.7 lib/neo4j/active_node/enum.rb
activegraph-10.0.0.pre.alpha.6 lib/neo4j/active_node/enum.rb
neo4j-10.0.0.pre.alpha.5 lib/neo4j/active_node/enum.rb
neo4j-10.0.0.pre.alpha.4 lib/neo4j/active_node/enum.rb
neo4j-10.0.0.pre.alpha.3 lib/neo4j/active_node/enum.rb
neo4j-10.0.0.pre.alpha.2 lib/neo4j/active_node/enum.rb
neo4j-10.0.0.pre.alpha.1 lib/neo4j/active_node/enum.rb
neo4j-9.6.1 lib/neo4j/active_node/enum.rb
neo4j-9.6.0 lib/neo4j/active_node/enum.rb
neo4j-9.5.3 lib/neo4j/active_node/enum.rb
neo4j-9.5.2 lib/neo4j/active_node/enum.rb
neo4j-9.5.0 lib/neo4j/active_node/enum.rb
neo4j-9.4.0 lib/neo4j/active_node/enum.rb