Skip to content

Instantly share code, notes, and snippets.

@ekhall
Last active January 2, 2016 21:29
Show Gist options
  • Save ekhall/8363639 to your computer and use it in GitHub Desktop.
Save ekhall/8363639 to your computer and use it in GitHub Desktop.
➜ MgDB git:(abs-neo4j) ✗ pry
[1] pry(main)> require 'yaml'
=> true
[2] pry(main)> require './model/abstract_node'
=> true
[3] pry(main)> myhash = YAML.load(File.open('yaml-model/patient.yaml'))
=> {:model_name=>"Patient",
:properties=>[:mrn, :firstname, :surname, :dob, :gender]}
[4] pry(main)> Patient = Mgdb::NodeFactory.get_node_class(myhash)
=> Kernel::Patient
[5] pry(main)> pat = Patient.new
Instantiated! # This is from Neo4j::Node
=> #<Kernel::Patient:0x000001033c6050>
[6] pry(main)> pat.mrn = 001
=> 1
[7] pry(main)> pat.firstname = "Bubba"
=> "Bubba"
[8] pry(main)> pat.surname = "Tee"
=> "Tee"
[9] pry(main)> pat.dob = Time.now
=> 2014-01-10 17:17:47 -0500
[10] pry(main)> pat.gender = 1
=> 1
[11] pry(main)>
# patient.yaml
---
:model_name: Patient
:properties:
- :mrn
- :firstname
- :surname
- :dob
- :gender
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment