class IsoBibItem::IsoDocumentId

Iso document id.

Attributes

id[R]

@return [String]

part_number[R]

@return [String]

prefix[R]

@return [String]

project_number[R]

@return [String]

subpart_number[R]

@return [String]

tc_document_number[R]

@return [Integer]

type[R]

@return [String]

Public Class Methods

new(**args) click to toggle source

@param project_number [String] @param part_number [String] @param subpart_number [String] @param prefix [String] @param id [String] @param type [String]

# File lib/iso_bib_item/iso_bibliographic_item.rb, line 50
def initialize(**args)
  @project_number = args[:project_number]
  @part_number    = args[:part_number]
  @subpart_number = args[:subpart_number]
  @prefix         = args[:prefix]
  @type           = args[:type]
  @id             = args[:id]
end

Public Instance Methods

all_parts() click to toggle source
# File lib/iso_bib_item/iso_bibliographic_item.rb, line 78
def all_parts
  @id = @id + " (all parts)"
end
remove_date() click to toggle source
# File lib/iso_bib_item/iso_bibliographic_item.rb, line 70
def remove_date
  case @type
  when "Chinese Standard" then @id = @id.sub(/-[12]\d\d\d/, "")
  else
    @id = @id.sub(/:[12]\d\d\d/, "")
  end
end
remove_part() click to toggle source

in docid manipulations, assume ISO as the default: id-part:year

# File lib/iso_bib_item/iso_bibliographic_item.rb, line 60
def remove_part
  @part_number = nil
  @subpart_number = nil
  case @type
  when "Chinese Standard" then @id = @id.sub(/\.\d+/, "")
  else 
    @id = @id.sub(/-\d+/, "")
  end
end
to_xml(builder) click to toggle source
# File lib/iso_bib_item/iso_bibliographic_item.rb, line 82
def to_xml(builder)
  attrs = {}
  attrs[:type] = @type if @type
  # builder.docidentifier project_number + '-' + part_number, **attrs
  builder.docidentifier id, **attrs
end