Sha256: 95fcd99a23c533560cd01e9bf9d91c74a6658b1da891acaffd33d90c57768a5a
Contents?: true
Size: 873 Bytes
Versions: 5
Compression:
Stored size: 873 Bytes
Contents
module ActiveGraph module Relationship module Wrapping class << self 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_element_id, rel.end_node_element_id, rel.type) end end def class_from_type(type) ActiveGraph::Relationship::Types::WRAPPED_CLASSES[type] || ActiveGraph::Relationship::Types::WRAPPED_CLASSES[type] = type.to_s.downcase.camelize end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems