Sha256: 20e1536804b0ce3dc51bcd6be8511488ff08ba141cc9294748ea78bc513e92c4

Contents?: true

Size: 886 Bytes

Versions: 3

Compression:

Stored size: 886 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 addendum
    ].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

3 entries across 3 versions & 1 rubygems

Version Path
relaton-iso-bib-1.20.0 lib/relaton_iso_bib/document_type.rb
relaton-iso-bib-1.19.2 lib/relaton_iso_bib/document_type.rb
relaton-iso-bib-1.19.1 lib/relaton_iso_bib/document_type.rb