module Neo4j::ActiveRel::Types::ClassMethods
Public Instance Methods
_wrapped_classes()
click to toggle source
# File lib/neo4j/active_rel/types.rb 59 def _wrapped_classes 60 WRAPPED_CLASSES 61 end
add_wrapped_class(type)
click to toggle source
# File lib/neo4j/active_rel/types.rb 63 def add_wrapped_class(type) 64 # WRAPPED_CLASSES[type.to_sym.downcase] = self.name 65 _wrapped_classes[type.to_sym] = self.name 66 end
inherited(subclass)
click to toggle source
# File lib/neo4j/active_rel/types.rb 27 def inherited(subclass) 28 subclass.type subclass.namespaced_model_name, true 29 end
namespaced_model_name()
click to toggle source
# File lib/neo4j/active_rel/types.rb 48 def namespaced_model_name 49 case Neo4j::Config[:module_handling] 50 when :demodulize 51 self.name.demodulize 52 when Proc 53 Neo4j::Config[:module_handling].call(self.name) 54 else 55 self.name 56 end 57 end
rel_type?()
click to toggle source
# File lib/neo4j/active_rel/types.rb 68 def rel_type? 69 !!@rel_type 70 end
type(given_type = nil, auto = false)
click to toggle source
When called without arguments, it will return the current setting or supply a default. When called with arguments, it will change the current setting. @param [String] given_type sets the relationship type when creating relationships via this class @param [Boolean] auto Should the given_type be changed in compliance with the gem’s rel decorator setting?
# File lib/neo4j/active_rel/types.rb 35 def type(given_type = nil, auto = false) 36 case 37 when !given_type && rel_type? 38 @rel_type 39 when given_type 40 assign_type!(given_type, auto) 41 else 42 assign_type!(namespaced_model_name, true) 43 end 44 end
Private Instance Methods
assign_type!(given_type, auto)
click to toggle source
# File lib/neo4j/active_rel/types.rb 74 def assign_type!(given_type, auto) 75 @rel_type = (auto ? decorated_rel_type(given_type) : given_type).tap do |type| 76 add_wrapped_class(type) 77 end 78 end