Class: Relaton::Iho::Docidentifier
- Inherits:
-
Bib::Docidentifier
- Object
- Bib::Docidentifier
- Relaton::Iho::Docidentifier
- Defined in:
- lib/relaton/iho/docidentifier.rb
Instance Attribute Summary collapse
-
#pubid ⇒ Object
readonly
Returns the value of attribute pubid.
Instance Method Summary collapse
- #content=(value) ⇒ Object
-
#initialize(attrs = {}, options = {}) ⇒ Docidentifier
constructor
A new instance of Docidentifier.
- #remove_date! ⇒ Object
- #remove_part! ⇒ Object
- #to_all_parts! ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(attrs = {}, options = {}) ⇒ Docidentifier
Returns a new instance of Docidentifier.
6 7 8 9 10 11 |
# File 'lib/relaton/iho/docidentifier.rb', line 6 def initialize(attrs = {}, = {}) pubid = attrs.is_a?(Hash) ? attrs.delete(:pubid) : nil attrs[:content] ||= pubid.to_s if pubid super @pubid = pubid if pubid end |
Instance Attribute Details
#pubid ⇒ Object (readonly)
Returns the value of attribute pubid.
4 5 6 |
# File 'lib/relaton/iho/docidentifier.rb', line 4 def pubid @pubid end |
Instance Method Details
#content=(value) ⇒ Object
13 14 15 16 |
# File 'lib/relaton/iho/docidentifier.rb', line 13 def content=(value) super @pubid = ::Pubid::Iho::Identifier.parse(value) if value end |
#remove_date! ⇒ Object
26 27 28 |
# File 'lib/relaton/iho/docidentifier.rb', line 26 def remove_date! @pubid&.year = nil end |
#remove_part! ⇒ Object
22 23 24 |
# File 'lib/relaton/iho/docidentifier.rb', line 22 def remove_part! @pubid&.part = nil end |
#to_all_parts! ⇒ Object
30 31 32 |
# File 'lib/relaton/iho/docidentifier.rb', line 30 def to_all_parts! @pubid&.all_parts = true end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/relaton/iho/docidentifier.rb', line 18 def to_h @pubid&.to_h || super end |