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.13.6 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.13.5 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.13.4 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.13.3 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.13.2 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.13.1 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.13.0 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.11 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.10 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.9 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.8 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.7 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.6 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.5 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.4 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.3 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.2 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.1 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.12.0 lib/relaton_ietf/ietf_bibliographic_item.rb
relaton-ietf-1.11.6 lib/relaton_ietf/ietf_bibliographic_item.rb