Sha256: b24e050dd820439d91ba40d6c8d635638338eb79c9ffb2e30a4c290032e87a93

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 Bytes

Contents

# Extends the Node class with a hash style accessor methods to the node's properties
org.neo4j.api.core.PropertyContainer.java_class.ruby_class.class_eval do 
  
  # Example:
  #    node[:name] #=> 'Matt'
  #
  def [](arg)
    get_property(arg.to_s)
  end
  
  # Example:
  #    node[:name] = 'Matt'
  #
  def []=(arg, value)
    set_property(arg.to_s, value)
  end
    
  def properties
    properties = {}
    propertyKeys.each do |property|
      properties[property] = self[property]
    end
    properties
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neo4jr-simple-0.1.3 lib/neo4jr/property_container_extension.rb