Sha256: 67005c3eb0ae9037041a24f9df6453de5362b2c523b3d57a7b0d097a56cc3124
Contents?: true
Size: 1019 Bytes
Versions: 1
Compression:
Stored size: 1019 Bytes
Contents
module Neoon module Model module Node def neo_node _cypher_query.find_node.run.data.first.first.data end def neo_create _cypher_query.create_node.run.data end alias_method :neo_save, :neo_create alias_method :neo_update, :neo_create def neo_destroy _cypher_query.delete_node.run.data end def neo_node_properties _neo_node.merge({ :_id => self.id }) end protected def _cypher_query Neoon::Cypher::InstanceQuery.new(self) end def _neo_node return {} unless self.class.neo_model_config.properties hash = self.class.neo_model_config.properties.inject({}) do |all, (field, block)| all[field] = if block[:block] instance_eval(&block[:block]) else self.send(field) rescue (raise "No field #{field} for #{self.class.name}") end all end hash.reject { |k, v| v.nil? } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
neoon-0.0.4 | lib/neoon/model/node.rb |