Sha256: f1118015f7958b354bc69dd77d27d29a13ece57ff67ef7d5acd7d1de71c7f552

Contents?: true

Size: 852 Bytes

Versions: 3

Compression:

Stored size: 852 Bytes

Contents

module RelatonIsoBib
  class DocumentType < RelatonBib::DocumentType
    DOCTYPES = %w[
      international-standard technical-specification technical-report
      publicly-available-specification international-workshop-agreement guide
      amendment technical-corrigendum directive
    ].freeze

    #
    # Create a new DocumentType object.
    #
    # @param [String] type document type
    # @param [String, nil] abbreviation type abbreviation
    #
    def initialize(type:, abbreviation: nil)
      check_doctype type
      super
    end

    #
    # Check if type is valid.
    #
    # @param [String] type document type
    #
    def check_doctype(type)
      unless DOCTYPES.include? type
        Util.warn "WARNING: invalid doctype: `#{type}`"
        Util.warn "Allowed doctypes are: `#{DOCTYPES.join('`, `')}`"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
relaton-iso-bib-1.18.1 lib/relaton_iso_bib/document_type.rb
relaton-iso-bib-1.18.0 lib/relaton_iso_bib/document_type.rb
relaton-iso-bib-1.17.0 lib/relaton_iso_bib/document_type.rb