Sha256: a921e2682020da1167eaa087d85fb1313c314333d7e745b69040039347ed6bdd

Contents?: true

Size: 1.05 KB

Versions: 46

Compression:

Stored size: 1.05 KB

Contents

module RelatonIetf
  class IetfBibliographicItem < RelatonBib::BibliographicItem
    DOCTYPES = %w[rfc internet-draft].freeze

    # @return [String, NilClass]
    attr_reader :doctype

    # @return [Array<String>]
    attr_reader :keyword

    # @param doctype [String]
    # @param keyword [Array<String>]
    def initialize(**args)
      if args[:doctype] && !DOCTYPES.include?(args[:doctype])
        warn "[relaton-ietf] WARNING: invalid doctype #{args[:doctype]}"
      end
      super
    end

    # @param hash [Hash]
    # @return [RelatonIetf::IetfBibliographicItem]
    def self.from_hash(hash)
      item_hash = ::RelatonIetf::HashConverter.hash_to_bib(hash)
      new(**item_hash)
    end

    # @param opts [Hash]
    # @option opts [Nokogiri::XML::Builder] :builder XML builder
    # @option opts [Boolean] :bibdata
    # @option opts [Symbol, NilClass] :date_format (:short), :full
    # @option opts [String, Symbol] :lang language
    # @return [String] XML
    def to_xml(**opts)
      opts[:date_format] ||= :short
      super(**opts)
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
relaton-ietf-1.9.6 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.9.5 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.9.4 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.9.3 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.9.2 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.9.1 lib/relaton_ietf/ietf_bibliographic_item.rb