class Slaw::Grammars::ZA::Act::Act

Constants

EXPRESSION_URI
FRBR_URI
MANIFESTATION_URI
WORK_URI

Public Instance Methods

to_xml(b, idprefix=nil, i=0) click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 14
def to_xml(b, idprefix=nil, i=0)
  b.act(contains: 'originalVersion', name: 'act') { |b|
    write_meta(b)
    write_preface(b)
    write_preamble(b)
    write_body(b)
    write_schedules(b)
  }
end
write_body(b) click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 70
def write_body(b)
  body.to_xml(b)
end
write_identification(b) click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 35
def write_identification(b)
  b.identification(source: "#slaw") { |b|
    # use stub values so that we can generate a validating document
    b.FRBRWork { |b|
      b.FRBRthis(value: "#{WORK_URI}/main")
      b.FRBRuri(value: WORK_URI)
      b.FRBRalias(value: 'Short Title', name: 'title')
      b.FRBRdate(date: '1980-01-01', name: 'Generation')
      b.FRBRauthor(href: '#council')
      b.FRBRcountry(value: 'za')
    }
    b.FRBRExpression { |b|
      b.FRBRthis(value: "#{EXPRESSION_URI}/main")
      b.FRBRuri(value: EXPRESSION_URI)
      b.FRBRdate(date: '1980-01-01', name: 'Generation')
      b.FRBRauthor(href: '#council')
      b.FRBRlanguage(language: 'eng')
    }
    b.FRBRManifestation { |b|
      b.FRBRthis(value: "#{MANIFESTATION_URI}/main")
      b.FRBRuri(value: MANIFESTATION_URI)
      b.FRBRdate(date: Time.now.strftime('%Y-%m-%d'), name: 'Generation')
      b.FRBRauthor(href: '#slaw')
    }
  }
end
write_meta(b) click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 24
def write_meta(b)
  b.meta { |b|
    write_identification(b)

    b.references(source: "#this") {
      b.TLCOrganization(eId: 'slaw', href: 'https://github.com/longhotsummer/slaw', showAs: "Slaw")
      b.TLCOrganization(eId: 'council', href: '/ontology/organization/za/council', showAs: "Council")
    }
  }
end
write_preamble(b) click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 66
def write_preamble(b)
  preamble.to_xml(b) if preamble.respond_to? :to_xml
end
write_preface(b) click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 62
def write_preface(b)
  preface.to_xml(b) if preface.respond_to? :to_xml
end
write_schedules(b) click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 74
def write_schedules(b)
  if schedules.text_value != ""
    schedules.to_xml(b)
  end
end