Method: OM::XML::Terminology::Builder#root

Defined in:
lib/om/xml/terminology.rb

#root(opts, &block) ⇒ Object

Set the root of the Terminology, along with namespace & schema info



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/om/xml/terminology.rb', line 46

def root opts, &block
  @schema = opts.fetch(:schema,nil)
  opts.select {|k,v| k.to_s.include?("xmlns")}.each do |ns_pair|
    @namespaces[ns_pair.first.to_s] = ns_pair.last
    if ns_pair.first.to_s == "xmlns"
      @namespaces["oxns"] = ns_pair.last
    end
  end
  path = opts.fetch(:path,:root).to_s.sub(/[_!]$/, '')
  root_term_builder = OM::XML::Term::Builder.new(path).tap do |t|
    t.root_term= true
  end
  term_opts = opts.dup
  term_opts.delete(:schema)
  root_term_builder.settings.merge!(term_opts)
  @term_builders[root_term_builder.name] = root_term_builder

  return root_term_builder
end