Class: RelatonIetf::IetfBibliographicItem

Inherits:
RelatonBib::BibliographicItem
  • Object
show all
Defined in:
lib/relaton_ietf/ietf_bibliographic_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ IetfBibliographicItem

Returns a new instance of IetfBibliographicItem.

Parameters:

  • doctype (String)
  • keyword (Array<String>)


11
12
13
14
15
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 11

def initialize(**args)
  @doctype = args.delete :doctype
  @keyword = args.delete(:keyword) || []
  super
end

Instance Attribute Details

#doctypeString, NilClass (readonly)

Returns:

  • (String, NilClass)


4
5
6
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 4

def doctype
  @doctype
end

#keywordArray<String> (readonly)

Returns:

  • (Array<String>)


7
8
9
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 7

def keyword
  @keyword
end

Instance Method Details

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

Parameters:

  • builder (defaults to: nil)
  • opts (Hash)

Options Hash (**opts):

  • :date_format (Symbol, NilClass) — default: :short

    , :full



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 20

def to_xml(builder = nil, **opts)
  opts[:date_format] ||= :short
  super builder, **opts do |b|
    if opts[:bibdata]
      b.ext do
        b.doctype doctype if doctype
        keyword.each { |k| b.keyword k }
      end
    end
  end
end