Here is the update API
include Persistence
persistent 'people', 'employees', 'children'
person = Person.new('Alan')
employee = Employee.new('Bob', 12345)
txn
people << person
employees << employee
person.children = Array.new
employee.children = Array.new
person.children << Person.new('
Alan McKean wrote:
I like your suggestions to make it more Rubyish. I will fix it up.I only
did it (created an instance variable @people) because I knew how to do
it. Is people (in your example) a local variable and is there an API for
creating locals?
people gets created as an attribute:
cl
I like your suggestions to make it more Rubyish. I will fix it up.I
only did it (created an instance variable @people) because I knew how
to do it. Is people (in your example) a local variable and is there
an API for creating locals?
BTW, this API is wholly my design and I am not nearly as
Alan McKean wrote:
To write persistent objects
require 'java'
require 'employee'
require 'persistence'
include Persistence
I presume you would normally include this into a custom type rather than
into Object, but it's pretty convenient you can do this anywhere to gain
persistence functional
Here is the sample code that I have been using to persist some simple
objects:
To write persistent objects
require 'java'
require 'employee'
require 'persistence'
include Persistence
persistent 'people'
person = Person.new('Alan')
employee = Employee.new('Bob', 12345)
@people.store(person)
@