Class: RelatonIsoBib::DocumentType

Inherits:
RelatonBib::DocumentType
  • Object
show all
Defined in:
lib/relaton_iso_bib/document_type.rb

Constant Summary collapse

DOCTYPES =
%w[
  international-standard technical-specification technical-report
  publicly-available-specification international-workshop-agreement guide
  recommendation amendment technical-corrigendum directive committee-document addendum
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(type:, abbreviation: nil) ⇒ DocumentType

Create a new DocumentType object.

Parameters:

  • type (String)

    document type

  • abbreviation (String, nil) (defaults to: nil)

    type abbreviation



15
16
17
18
# File 'lib/relaton_iso_bib/document_type.rb', line 15

def initialize(type:, abbreviation: nil)
  check_doctype type
  super
end

Instance Method Details

#check_doctype(type) ⇒ Object

Check if type is valid.

Parameters:

  • type (String)

    document type



25
26
27
28
29
30
# File 'lib/relaton_iso_bib/document_type.rb', line 25

def check_doctype(type)
  unless DOCTYPES.include? type
    Util.warn "Invalid doctype: `#{type}`"
    Util.warn "Allowed doctypes are: `#{DOCTYPES.join('`, `')}`"
  end
end