Module: Neo4j::ActiveRel::Types::ClassMethods
Instance Method Summary
collapse
#decorated_rel_type, decorated_rel_type, rel_transformer
Instance Method Details
#_wrapped_classes ⇒ Object
59
60
61
|
# File 'lib/neo4j/active_rel/types.rb', line 59
def _wrapped_classes
WRAPPED_CLASSES
end
|
#add_wrapped_class(type) ⇒ Object
63
64
65
66
|
# File 'lib/neo4j/active_rel/types.rb', line 63
def add_wrapped_class(type)
_wrapped_classes[type.to_sym] = self.name
end
|
#inherited(subclass) ⇒ Object
27
28
29
|
# File 'lib/neo4j/active_rel/types.rb', line 27
def inherited(subclass)
subclass.type subclass.namespaced_model_name, true
end
|
#namespaced_model_name ⇒ Object
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/neo4j/active_rel/types.rb', line 48
def namespaced_model_name
case Neo4j::Config[:module_handling]
when :demodulize
self.name.demodulize
when Proc
Neo4j::Config[:module_handling].call(self.name)
else
self.name
end
end
|
68
69
70
|
# File 'lib/neo4j/active_rel/types.rb', line 68
def rel_type?
!!@rel_type
end
|
#type(given_type = nil, auto = false) ⇒ Object
Also known as:
rel_type, _type
When called without arguments, it will return the current setting or supply a default. When called with arguments, it will change the current setting.
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/neo4j/active_rel/types.rb', line 35
def type(given_type = nil, auto = false)
case
when !given_type && rel_type?
@rel_type
when given_type
assign_type!(given_type, auto)
else
assign_type!(namespaced_model_name, true)
end
end
|