Sha256: ef770b001dfb59e712ca4d5cf8cf6dd5f4755cbb553881059d8b30de684816a2

Contents?: true

Size: 667 Bytes

Versions: 10

Compression:

Stored size: 667 Bytes

Contents

class Neo4j::Relationship
  module Wrapper
    def wrapper
      props.symbolize_keys!
      # return self unless props.is_a?(Hash)
      begin
        most_concrete_class = sorted_wrapper_classes
        wrapped_rel = most_concrete_class.constantize.new
      rescue NameError
        return self
      end

      wrapped_rel.init_on_load(self, self._start_node_id, self._end_node_id, self.rel_type)
      wrapped_rel
    end

    private

    def sorted_wrapper_classes
      props[Neo4j::Config.class_name_property] || class_from_type
    end

    def class_from_type
      Neo4j::ActiveRel::Types::WRAPPED_CLASSES[rel_type] || rel_type.camelize
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
neo4j-5.0.0 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-5.0.0.rc.3 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-5.0.0.rc.2 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-5.0.0.rc.1 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-4.1.5 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-4.1.4 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-4.1.3 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-4.1.2 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-4.1.1 lib/neo4j/active_rel/rel_wrapper.rb
neo4j-4.1.0 lib/neo4j/active_rel/rel_wrapper.rb