#create!
def create! drop_incompatible! return if exist? label_object.send(:"create_#{type}", property, options) end
#default_options
def default_options {} end
#drop!
def drop! label_object.send(:"drop_#{type}", property, options) end
#drop_incompatible!
def drop_incompatible! incompatible_operation_classes.each do |clazz| operation = clazz.new(label_name, property) operation.drop! if operation.exist? end end
#exist?
def exist? label_object.indexes[:property_keys].include?([property]) end
#incompatible_operation_classes
def incompatible_operation_classes self.class.incompatible_operation_classes end
.incompatible_operation_classes
def self.incompatible_operation_classes [UniqueConstraintOperation] end
#initialize
def initialize(label_name, property, options = default_options) @label_name = label_name.to_sym @property = property.to_sym @options = options end
- #label_name
Returns the value of attribute label_name
def label_name @label_name end
#label_object
def label_object @label_object ||= Neo4j::Label.create(label_name) end
- #options
Returns the value of attribute options
def options @options end
- #property
Returns the value of attribute property
def property @property end
#type
def type 'index' end