Sha256: 0a2fee1cc3847224c1ab35a2e1d3b001dff67bc6d6f634e6abb8c82c3171fb63

Contents?: true

Size: 1.19 KB

Versions: 179

Compression:

Stored size: 1.19 KB

Contents

require 'employment_schema'
require 'rexml/document'
include REXML
include EMP
##
## create a model container for the data instances
##
mydata = EMP::Model___data.new
mydata.model_elements = []
##
## create an organization
##
org1 = EMP::Organization.new
##
## check that all mandatory attrs are set
##
puts 'Without name, org1 isValid = ' + org1.isValid.to_s
org1.name = 'Acme Plumbing'
##
## check again that all mandatory attrs are set
##
puts 'With name, org1 isValid = ' + org1.isValid.to_s

per1 = EMP::Person.new
per1.names = []
per1.names.push 'Joe'
per1.names.push 'Plumber'

emp1 = EMP::Employment.new
emp1.the_person = per1
emp1.the_organization = org1
emp1.start_date = '2008-04-01'
emp1.end_date = '2008-06-01'
emp1.job_title = 'Apprentice'
emp1.ended_by = per1
emp1.employment_type = 'atwill'

##
## put all instances in the model container, this is what gets written to XML
##
mydata.model_elements.push org1
mydata.model_elements.push emp1
mydata.model_elements.push per1
##
## Set up the XML file and write all data in the model container to the file
##
datafile = File.new("example_employment_data.xml","w")
p28file = REXML::Document.new
mydata.writeP28e2 p28file
datafile.puts p28file
datafile.close

Version data entries

179 entries across 179 versions & 1 rubygems

Version Path
expressir-1.2.4 original/examples/employment/example_employment_writer.rb
expressir-1.2.4-x86_64-linux original/examples/employment/example_employment_writer.rb
expressir-1.2.4-x86_64-darwin original/examples/employment/example_employment_writer.rb
expressir-1.2.4-x86-mingw32 original/examples/employment/example_employment_writer.rb
expressir-1.2.4-x86-linux original/examples/employment/example_employment_writer.rb
expressir-1.2.4-x64-mingw32 original/examples/employment/example_employment_writer.rb
expressir-1.2.4-arm64-darwin original/examples/employment/example_employment_writer.rb
expressir-1.2.4-aarch64-linux original/examples/employment/example_employment_writer.rb
expressir-1.2.3 original/examples/employment/example_employment_writer.rb
expressir-1.2.3-x86_64-linux original/examples/employment/example_employment_writer.rb
expressir-1.2.3-x86_64-darwin original/examples/employment/example_employment_writer.rb
expressir-1.2.3-x86-mingw32 original/examples/employment/example_employment_writer.rb
expressir-1.2.3-x86-linux original/examples/employment/example_employment_writer.rb
expressir-1.2.3-x64-mingw32 original/examples/employment/example_employment_writer.rb
expressir-1.2.3-arm64-darwin original/examples/employment/example_employment_writer.rb
expressir-1.2.3-aarch64-linux original/examples/employment/example_employment_writer.rb
expressir-1.2.1 original/examples/employment/example_employment_writer.rb
expressir-1.2.1-x86_64-linux original/examples/employment/example_employment_writer.rb
expressir-1.2.1-x86_64-darwin original/examples/employment/example_employment_writer.rb
expressir-1.2.1-x86-mingw32 original/examples/employment/example_employment_writer.rb