Sha256: 5f162630e548770234ab4512f9056b3ffc81c1ad0f10072d9cb08b24d2e6e8e2

Contents?: true

Size: 689 Bytes

Versions: 1

Compression:

Stored size: 689 Bytes

Contents

module Neo4j
  # Responsible for loading the correct Ruby wrapper class for the Neo4j Entity
  module Wrapper
    module ClassMethods
      # Loads the wrapper by using the original new method and initialize it
      # @private
      def _load_wrapper(node)
        wrapped_node = self.orig_new
        wrapped_node.init_on_load(node)
        wrapped_node
      end

      # Creates an alias to the original new method:  <tt>orig_new</tt>
      # @private
      def self.extended(klass)
        klass.instance_eval do
          class << self
            alias_method :orig_new, :new
          end
        end unless klass.respond_to?(:orig_new)
        super
      end
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neo4j-wrapper-0.0.2-java lib/neo4j-wrapper/class_methods.rb