Class: IsoBibItem::IsoDocumentId
- Inherits:
-
Object
- Object
- IsoBibItem::IsoDocumentId
- Defined in:
- lib/iso_bib_item/iso_bibliographic_item.rb
Overview
Iso document id.
Instance Attribute Summary collapse
- #id ⇒ String readonly
- #part_number ⇒ String readonly
- #prefix ⇒ String readonly
- #project_number ⇒ String readonly
- #subpart_number ⇒ String readonly
- #tc_document_number ⇒ Integer readonly
- #type ⇒ String readonly
Instance Method Summary collapse
- #all_parts ⇒ Object
-
#initialize(**args) ⇒ IsoDocumentId
constructor
A new instance of IsoDocumentId.
- #remove_date ⇒ Object
-
#remove_part ⇒ Object
in docid manipulations, assume ISO as the default: id-part:year.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(**args) ⇒ IsoDocumentId
Returns a new instance of IsoDocumentId.
50 51 52 53 54 55 56 57 |
# 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 |
Instance Attribute Details
#id ⇒ String (readonly)
36 37 38 |
# File 'lib/iso_bib_item/iso_bibliographic_item.rb', line 36 def id @id end |
#part_number ⇒ String (readonly)
30 31 32 |
# File 'lib/iso_bib_item/iso_bibliographic_item.rb', line 30 def part_number @part_number end |
#prefix ⇒ String (readonly)
39 40 41 |
# File 'lib/iso_bib_item/iso_bibliographic_item.rb', line 39 def prefix @prefix end |
#project_number ⇒ String (readonly)
27 28 29 |
# File 'lib/iso_bib_item/iso_bibliographic_item.rb', line 27 def project_number @project_number end |
#subpart_number ⇒ String (readonly)
33 34 35 |
# File 'lib/iso_bib_item/iso_bibliographic_item.rb', line 33 def subpart_number @subpart_number end |
#tc_document_number ⇒ Integer (readonly)
24 25 26 |
# File 'lib/iso_bib_item/iso_bibliographic_item.rb', line 24 def tc_document_number @tc_document_number end |
#type ⇒ String (readonly)
42 43 44 |
# File 'lib/iso_bib_item/iso_bibliographic_item.rb', line 42 def type @type end |
Instance Method Details
#all_parts ⇒ Object
78 79 80 |
# File 'lib/iso_bib_item/iso_bibliographic_item.rb', line 78 def all_parts @id = @id + " (all parts)" end |
#remove_date ⇒ Object
70 71 72 73 74 75 76 |
# 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 ⇒ Object
in docid manipulations, assume ISO as the default: id-part:year
60 61 62 63 64 65 66 67 68 |
# 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) ⇒ Object
82 83 84 85 86 87 |
# 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 |