Module: ActiveGraph::Relationship::Types::ClassMethods
Instance Method Summary
collapse
#decorated_rel_type, decorated_rel_type, rel_transformer
Instance Method Details
#_wrapped_classes ⇒ Object
57
58
59
|
# File 'lib/active_graph/relationship/types.rb', line 57
def _wrapped_classes
WRAPPED_CLASSES
end
|
#add_wrapped_class(type) ⇒ Object
61
62
63
64
|
# File 'lib/active_graph/relationship/types.rb', line 61
def add_wrapped_class(type)
_wrapped_classes[type.to_sym] = self.name
end
|
#inherited(subclass) ⇒ Object
27
28
29
|
# File 'lib/active_graph/relationship/types.rb', line 27
def inherited(subclass)
subclass.type subclass.namespaced_model_name, true
end
|
#namespaced_model_name ⇒ Object
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/active_graph/relationship/types.rb', line 46
def namespaced_model_name
case ActiveGraph::Config[:module_handling]
when :demodulize
self.name.demodulize
when Proc
ActiveGraph::Config[:module_handling].call(self.name)
else
self.name
end
end
|
#type(given_type = nil, auto = false) ⇒ Object
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/active_graph/relationship/types.rb', line 35
def type(given_type = nil, auto = false)
case
when !given_type && type?
@type
when given_type
assign_type!(given_type, auto)
else
assign_type!(namespaced_model_name, true)
end
end
|
66
67
68
|
# File 'lib/active_graph/relationship/types.rb', line 66
def type?
!!@type
end
|