Class: RelatonIeee::PubId
- Inherits:
-
Object
- Object
- RelatonIeee::PubId
- Defined in:
- lib/relaton_ieee/pub_id.rb
Defined Under Namespace
Classes: Id
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#array(pid) ⇒ Array<Hash>
Convert to array.
-
#initialize(pubid) ⇒ PubId
constructor
IEEE publication id.
-
#to_id ⇒ String
Generate ID without publisher and second number.
-
#to_s(trademark: false) ⇒ String
PubId string representation.
Constructor Details
Instance Attribute Details
#pubid ⇒ Array<RelatonIeee::PubId::Id> (readonly)
103 104 105 |
# File 'lib/relaton_ieee/pub_id.rb', line 103 def pubid @pubid end |
Instance Method Details
#array(pid) ⇒ Array<Hash>
Convert to array
121 122 123 |
# File 'lib/relaton_ieee/pub_id.rb', line 121 def array(pid) pid.is_a?(Array) ? pid : [pid] end |
#to_id ⇒ String
Generate ID without publisher and second number
141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/relaton_ieee/pub_id.rb', line 141 def to_id # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity out = pubid[0].to_s if pubid.size > 1 out += pubid[1].edition_to_s if pubid[0].edition.nil? out += pubid[1].draft_to_s if pubid[0].draft.nil? out += pubid[1].rev_to_s if pubid[0].rev.nil? out += pubid[1].corr_to_s if pubid[0].corr.nil? out += pubid[1].amd_to_s if pubid[0].amd.nil? out += pubid[1].year_to_s if pubid[0].year.nil? out += pubid[1].month_to_s if pubid[0].month.nil? out += pubid[1].redline_to_s unless pubid[0].redline end out end |
#to_s(trademark: false) ⇒ String
PubId string representation
132 133 134 |
# File 'lib/relaton_ieee/pub_id.rb', line 132 def to_s(trademark: false) pubid.map { |id| id.to_s(trademark: trademark) }.join("/") end |