Class: RelatonIeee::PubId::Id
- Inherits:
-
Object
- Object
- RelatonIeee::PubId::Id
- Defined in:
- lib/relaton_ieee/pub_id.rb
Instance Attribute Summary collapse
- #amd ⇒ String? readonly
- #approval ⇒ String? readonly
- #corr ⇒ String? readonly
- #draft ⇒ String? readonly
- #edition ⇒ String? readonly
- #month ⇒ String? readonly
- #number ⇒ String readonly
- #part ⇒ String? readonly
- #publisher ⇒ String? readonly
- #redline ⇒ String? readonly
- #rev ⇒ String? readonly
- #stage ⇒ String? readonly
- #status ⇒ String? readonly
- #year ⇒ String? readonly
Instance Method Summary collapse
- #amd_to_s ⇒ Object
- #corr_to_s ⇒ Object
- #draft_to_s ⇒ Object
- #edition_to_s ⇒ Object
-
#initialize(number:, **args) ⇒ Id
constructor
PubId constructor.
- #month_to_s ⇒ Object
- #redline_to_s ⇒ Object
- #rev_to_s ⇒ Object
-
#to_s(trademark: false) ⇒ String
PubId string representation.
- #year_to_s ⇒ Object
Constructor Details
#initialize(number:, **args) ⇒ Id
PubId constructor
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/relaton_ieee/pub_id.rb', line 31 def initialize(number:, **args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize @publisher = args[:publisher] @stage = args[:stage] @number = number @part = args[:part] @status = args[:status] @approval = args[:approval] @edition = args[:edition] @draft = args[:draft] @rev = args[:rev] @corr = args[:corr] @amd = args[:amd] @year = args[:year] @month = args[:month] @redline = args[:redline] end |
Instance Attribute Details
#amd ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def amd @amd end |
#approval ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def approval @approval end |
#corr ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def corr @corr end |
#draft ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def draft @draft end |
#edition ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def edition @edition end |
#month ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def month @month end |
#number ⇒ String (readonly)
5 6 7 |
# File 'lib/relaton_ieee/pub_id.rb', line 5 def number @number end |
#part ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def part @part end |
#publisher ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def publisher @publisher end |
#redline ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def redline @redline end |
#rev ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def rev @rev end |
#stage ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def stage @stage end |
#status ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def status @status end |
#year ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_ieee/pub_id.rb', line 8 def year @year end |
Instance Method Details
#amd_to_s ⇒ Object
85 86 87 |
# File 'lib/relaton_ieee/pub_id.rb', line 85 def amd_to_s amd ? "/Amd#{amd}" : "" end |
#corr_to_s ⇒ Object
81 82 83 |
# File 'lib/relaton_ieee/pub_id.rb', line 81 def corr_to_s corr ? "/Cor#{corr}" : "" end |
#draft_to_s ⇒ Object
73 74 75 |
# File 'lib/relaton_ieee/pub_id.rb', line 73 def draft_to_s draft ? "/D-#{draft}" : "" end |
#edition_to_s ⇒ Object
69 70 71 |
# File 'lib/relaton_ieee/pub_id.rb', line 69 def edition_to_s edition ? "/E-#{edition}" : "" end |
#month_to_s ⇒ Object
93 94 95 |
# File 'lib/relaton_ieee/pub_id.rb', line 93 def month_to_s month ? "-#{month}" : "" end |
#redline_to_s ⇒ Object
97 98 99 |
# File 'lib/relaton_ieee/pub_id.rb', line 97 def redline_to_s redline ? " Redline" : "" end |
#rev_to_s ⇒ Object
77 78 79 |
# File 'lib/relaton_ieee/pub_id.rb', line 77 def rev_to_s rev ? "/R-#{rev}" : "" end |
#to_s(trademark: false) ⇒ String
PubId string representation
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/relaton_ieee/pub_id.rb', line 55 def to_s(trademark: false) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity out = number out = "#{stage} #{out}" if stage out = "#{approval} #{out}" if approval out = "#{status} #{out}" if status out = "#{publisher} #{out}" if publisher out += ".#{part}" if part if trademark out += out.match?(/^IEEE\s(Std\s)?(802|2030)/) ? "\u00AE" : "\u2122" end out += edition_to_s + draft_to_s + rev_to_s + corr_to_s + amd_to_s out + year_to_s + month_to_s + redline_to_s end |
#year_to_s ⇒ Object
89 90 91 |
# File 'lib/relaton_ieee/pub_id.rb', line 89 def year_to_s year ? "-#{year}" : "" end |