11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/active_graph/relationship/rel_wrapper.rb', line 11
def wrapper(rel)
rel.properties.symbolize_keys!
begin
most_concrete_class = class_from_type(rel.type).constantize
return rel unless most_concrete_class < ActiveGraph::Relationship
most_concrete_class.new
rescue NameError => e
raise e unless e.message =~ /(uninitialized|wrong) constant/
return rel
end.tap do |wrapped_rel|
wrapped_rel.init_on_load(rel, rel.start_node_id, rel.end_node_id, rel.type)
end
end
|