Class: Metanorma::Tools::IsoGraphicFilename

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/metanorma/tools/iso_graphic_filename.rb

Constant Summary collapse

VALID_STAGE_CODES =
%w[pwi np awi wd cd dis fdis prf].freeze
VALID_SUPPLEMENT_TYPES =
%w[amd cor].freeze
VALID_CONTENT_TYPES =
%w[figure table key text special_layout].freeze
VALID_LANGUAGE_CODES =
%w[e f r s a d].freeze

Instance Method Summary collapse

Instance Method Details

#generate_filenameObject



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/metanorma/tools/iso_graphic_filename.rb', line 47

def generate_filename
  document_portion = build_document_portion
  content_portion = build_content_portion
  language_portion = build_language_portion
  original_portion = build_original_filename_portion

  filename_parts = [document_portion, content_portion, language_portion, original_portion].compact
  filename = filename_parts.join('')

  "#{filename}.#{file_extension}"
end

#inspectObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/metanorma/tools/iso_graphic_filename.rb', line 63

def inspect
  attrs = {
    standard_number: standard_number,
    part_number: part_number,
    edition_number: edition_number,
    stage_code: stage_code,
    supplement_type: supplement_type,
    supplement_number: supplement_number,
    content_type: content_type,
    figure_number: figure_number,
    subfigure: subfigure,
    table_number: table_number,
    key_number: key_number,
    text_number: text_number,
    language_code: language_code,
    file_extension: file_extension
  }.compact
  "#<IsoGraphicFilename #{attrs}>"
end

#to_sObject



59
60
61
# File 'lib/metanorma/tools/iso_graphic_filename.rb', line 59

def to_s
  generate_filename
end