Sha256: 30ef97ab28e1e04a0746f175ec0437352a339e6d9b728eabd63adf4fc9046514

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

module RelatonIsoBib
  class DocumentType < RelatonBib::DocumentType
    DOCTYPES = %w[
      international-standard technical-specification technical-report
      publicly-available-specification international-workshop-agreement guide
      recommendation amendment technical-corrigendum directive committee-document
    ].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 "Invalid doctype: `#{type}`"
        Util.warn "Allowed doctypes are: `#{DOCTYPES.join('`, `')}`"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
relaton-iso-bib-1.19.0 lib/relaton_iso_bib/document_type.rb