Class: RelatonOgc::OgcBibliographicItem

Inherits:
RelatonBib::BibliographicItem
  • Object
show all
Defined in:
lib/relaton_ogc/ogc_bibliographic_item.rb

Constant Summary collapse

TYPES =
%w[
  abstract-specification-topic best-practice
  change-request-supporting-document
  community-practice community-standard discussion-paper engineering-report
  other policy reference-model release-notes standard user-guide white-paper
  test-suite
].freeze
SUBTYPES =
%w[
  conceptual-model conceptual-model-and-encoding
  conceptual-model-and-implementation encoding extension implementation
  profile profile-with-extension general
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ OgcBibliographicItem

Returns a new instance of OgcBibliographicItem.

Parameters:

  • docsubtype (String)


21
22
23
24
25
26
27
28
29
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 21

def initialize(**args)
  if args[:docsubtype] && !SUBTYPES.include?(args[:docsubtype])
    warn "[relaton-ogc] WARNING: invalid document subtype: #{args[:docsubtype]}"
  end

  @docsubtype = args.delete :docsubtype
  super
  # @doctype = args[:doctype]
end

Instance Attribute Details

#docsubtypeString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 18

def docsubtype
  @docsubtype
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


32
33
34
35
36
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 32

def to_hash
  hash = super
  hash["docsubtype"] = docsubtype if docsubtype
  hash
end

#to_xml(builder = nil, **opts) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder) (defaults to: nil)
  • opts (Hash)

Options Hash (**opts):

  • :bibdata (Boolean)


41
42
43
44
45
46
47
48
49
50
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 41

def to_xml(builder = nil, **opts)
  super do |b|
    b.ext do
      b.doctype doctype if doctype
      b.docsubtype docsubtype if docsubtype
      editorialgroup&.to_xml b
      ics.each { |i| i.to_xml b }
    end
  end
end