Class: Obp::Access::Renderer::Elements::Root

Inherits:
Object
  • Object
show all
Defined in:
lib/obp/access/elements/root.rb

Constant Summary collapse

TITLE_PARTS =
%w[intro main compl].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(urn:, metas:) ⇒ Root

Returns a new instance of Root.



12
13
14
15
# File 'lib/obp/access/elements/root.rb', line 12

def initialize(urn:, metas:)
  @urn = urn
  @metas = metas
end

Instance Attribute Details

#metasObject (readonly)

Returns the value of attribute metas.



10
11
12
# File 'lib/obp/access/elements/root.rb', line 10

def metas
  @metas
end

#urnObject (readonly)

Returns the value of attribute urn.



10
11
12
# File 'lib/obp/access/elements/root.rb', line 10

def urn
  @urn
end

Instance Method Details

#contentObject

rubocop:disable Metrics/AbcSize



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/obp/access/elements/root.rb', line 17

def content # rubocop:disable Metrics/AbcSize
  Nokogiri::XML::Builder.new(namespace_inheritance: false,
                             encoding: "UTF-8") do |xml|
    xml.standard("xmlns:ali": "http://www.niso.org/schemas/ali/1.0/",
                 "xmlns:mml": "http://www.w3.org/1998/Math/MathML",
                 "xmlns:tbx": "urn:iso:std:iso:30042:ed-2",
                 "xmlns:xlink": "http://www.w3.org/1999/xlink",
                 "dtd-version": "1.0") do
      xml.front do
        xml.public_send(:"std-meta", "std-meta-type": "international") do
          std_meta_content(xml)
        end
      end
      xml.body
      xml.back
    end
  end
end

#to_documentObject



36
37
38
# File 'lib/obp/access/elements/root.rb', line 36

def to_document
  content.doc
end