Sha256: 0f5849fd03e239af17f6407a3fe6955eddb9c0b9e29e41d42aa7aee292b4d825
Contents?: true
Size: 1.93 KB
Versions: 3
Compression:
Stored size: 1.93 KB
Contents
module Neo4j::Mapping module NodeMixin extend Forwardable include Neo4j::Index def_delegators :@_java_node, :[]=, :[], :property?, :props, :attributes, :update, :neo_id, :id, :rels, :rel?, :to_param, :getId, :rel, :del, :list?, :print, :print_sub, :outgoing, :incoming, :both, :equal?, :eql?, :==, :exist?, :getRelationships # -------------------------------------------------------------------------- # Initialization methods # # Init this node with the specified java neo node # def init_on_load(java_node) # :nodoc: @_java_node = java_node end # Creates a new node and initialize with given properties. # def init_on_create(*args) # :nodoc: self[:_classname] = self.class.to_s if args[0].respond_to?(:each_pair) args[0].each_pair { |k, v| @_java_node.set_property(k.to_s, v) } end end # Returns the org.neo4j.graphdb.Node wrapped object def _java_node @_java_node end def trigger_rules self.class.trigger_rules(self) end def self.included(c) # :nodoc: c.instance_eval do # these constants are used in the Neo4j::RelClassMethods and Neo4j::PropertyClassMethods # they are defined here since they should only be defined once - # all subclasses share the same index, declared properties and index_updaters unless c.const_defined?(:DECL_RELATIONSHIPS) const_set(:ROOT_CLASS, self) const_set(:DECL_RELATIONSHIPS, {}) const_set(:PROPERTIES_INFO, {}) end class << self alias_method :orig_new, :new end end c.extend ClassMethods::Property c.extend ClassMethods::Relationship c.extend ClassMethods::Rule c.extend Neo4j::Index::ClassMethods def c.inherited(subclass) subclass.indexer subclass super end c.indexer c end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neo4j-1.0.0.beta.4 | lib/neo4j/mapping/node_mixin.rb |
neo4j-1.0.0.beta.3 | lib/neo4j/mapping/node_mixin.rb |
neo4j-1.0.0.beta.2 | lib/neo4j/mapping/node_mixin.rb |