lib/neo4j/index.rb in neo4j-1.0.0.beta.6 vs lib/neo4j/index.rb in neo4j-1.0.0.beta.7
- old
+ new
@@ -10,11 +10,11 @@
end
module ClassMethods
extend Forwardable
- def_delegators :@indexer, :index, :find, :index?, :index_type?, :clear_index_type, :rm_index_type, :add_index, :rm_index
+ def_delegators :@indexer, :index, :find, :index?, :index_type?, :clear_index_type, :rm_index_type, :add_index, :rm_index, :index_type_for
# Sets which indexer should be used for the given class.
# Returns the old one if there was an old indexer.
def indexer(clazz)
old = @indexer
@@ -99,9 +99,14 @@
Neo4j.default_db.event_handler.add(self)
end
def index?(field)
@field_types.include?(field.to_s)
+ end
+
+ def index_type_for(field)
+ return nil unless index?(field)
+ @field_types[field.to_s]
end
def index_type?(type)
@field_types.values.include?(type)
end
\ No newline at end of file