5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/active_graph/relationship/wrapping.rb', line 5
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
|