class ActiveGraph::Schema::Operation
Attributes
label[R]
options[R]
property[R]
Public Class Methods
incompatible_operation_classes()
click to toggle source
# File lib/active_graph/schema/operation.rb 17 def self.incompatible_operation_classes 18 [] 19 end
new(label, property, options = default_options)
click to toggle source
# File lib/active_graph/schema/operation.rb 6 def initialize(label, property, options = default_options) 7 @label = if label.is_a?(ActiveGraph::Core::Label) 8 label 9 else 10 ActiveGraph::Core::Label.new(label) 11 end 12 13 @property = property.to_sym 14 @options = options 15 end
Public Instance Methods
create!()
click to toggle source
# File lib/active_graph/schema/operation.rb 25 def create! 26 drop_incompatible! 27 return if exist? 28 schema_query(:"create_#{type}") 29 end
default_options()
click to toggle source
# File lib/active_graph/schema/operation.rb 50 def default_options 51 {} 52 end
drop!()
click to toggle source
# File lib/active_graph/schema/operation.rb 35 def drop! 36 schema_query(:"drop_#{type}") 37 end
drop_incompatible!()
click to toggle source
# File lib/active_graph/schema/operation.rb 39 def drop_incompatible! 40 incompatible_operation_classes.each do |clazz| 41 operation = clazz.new(@label, property) 42 operation.drop! if operation.exist? 43 end 44 end
exist?()
click to toggle source
# File lib/active_graph/schema/operation.rb 46 def exist? 47 fail 'Abstract class, not implemented' 48 end
incompatible_operation_classes()
click to toggle source
# File lib/active_graph/schema/operation.rb 31 def incompatible_operation_classes 32 self.class.incompatible_operation_classes 33 end
label_object()
click to toggle source
# File lib/active_graph/schema/operation.rb 21 def label_object 22 label 23 end
type()
click to toggle source
# File lib/active_graph/schema/operation.rb 54 def type 55 fail 'Abstract class, not implemented' 56 end
Private Instance Methods
schema_query(method)
click to toggle source
# File lib/active_graph/schema/operation.rb 60 def schema_query(method) 61 label.send(method, property, options) 62 end