Class: RelatonIeee::IeeeBibliographicItem
- Inherits:
-
RelatonBib::BibliographicItem
- Object
- RelatonBib::BibliographicItem
- RelatonIeee::IeeeBibliographicItem
- Defined in:
- lib/relaton_ieee/ieee_bibliographic_item.rb
Constant Summary collapse
- SUBTYPES =
%w[amendment corrigendum erratum].freeze
Instance Attribute Summary collapse
- #editorialgroup ⇒ RelatonIeee::EditorialGroup? readonly
- #holdstatus ⇒ String? readonly
- #pubstatus ⇒ String? readonly
- #standard_modified ⇒ String? readonly
- #standard_status ⇒ String? readonly
-
#trialuse ⇒ Boolean?
readonly
Trial use.
Class Method Summary collapse
Instance Method Summary collapse
-
#ext_schema ⇒ String
Fetch flavor schema version.
-
#initialize(**args) ⇒ IeeeBibliographicItem
constructor
A new instance of IeeeBibliographicItem.
- #to_asciibib(prefix = "") ⇒ String
-
#to_hash(embedded: false) ⇒ Hash
Rnder as Hash.
-
#to_xml(**opts) ⇒ String
XML.
Constructor Details
#initialize(**args) ⇒ IeeeBibliographicItem
Returns a new instance of IeeeBibliographicItem.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 25 def initialize(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength if args[:docsubtype] && !SUBTYPES.include?(args[:docsubtype]) Util.warn "Invalid docsubtype: `#{args[:docsubtype]}`. " \ "It should be one of: `#{SUBTYPES.join('`, `')}`." end eg = args.delete(:editorialgroup) @trialuse = args.delete(:trialuse) @standard_status = args.delete(:standard_status) @standard_modified = args.delete(:standard_modified) @pubstatus = args.delete(:pubstatus) @holdstatus = args.delete(:holdstatus) super @editorialgroup = eg end |
Instance Attribute Details
#editorialgroup ⇒ RelatonIeee::EditorialGroup? (readonly)
6 7 8 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 6 def editorialgroup @editorialgroup end |
#holdstatus ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 12 def holdstatus @holdstatus end |
#pubstatus ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 12 def pubstatus @pubstatus end |
#standard_modified ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 12 def standard_modified @standard_modified end |
#standard_status ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 12 def standard_status @standard_status end |
#trialuse ⇒ Boolean? (readonly)
Returns Trial use.
9 10 11 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 9 def trialuse @trialuse end |
Class Method Details
.from_hash(hash) ⇒ RelatonIeee::IeeeBibliographicItem
51 52 53 54 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 51 def self.from_hash(hash) item_hash = ::RelatonIeee::HashConverter.hash_to_bib(hash) new(**item_hash) end |
Instance Method Details
#ext_schema ⇒ String
Fetch flavor schema version
45 46 47 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 45 def ext_schema @ext_schema ||= schema_versions["relaton-model-ieee"] end |
#to_asciibib(prefix = "") ⇒ String
100 101 102 103 104 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 100 def to_asciibib(prefix = "") out = super out += "#{prefix}.trialuse:: #{trialuse}\n" unless trialuse.nil? out end |
#to_hash(embedded: false) ⇒ Hash
Rnder as Hash
88 89 90 91 92 93 94 95 96 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 88 def to_hash(embedded: false) # rubocop:disable Metrics/AbcSize hash = super hash["trialuse"] = trialuse unless trialuse.nil? hash["ext"]["standard_status"] = standard_status unless standard_status.nil? hash["ext"]["standard_modified"] = standard_modified unless standard_modified.nil? hash["ext"]["pubstatus"] = pubstatus unless pubstatus.nil? hash["ext"]["holdstatus"] = holdstatus unless holdstatus.nil? hash end |
#to_xml(**opts) ⇒ String
Returns XML.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 61 def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity super(**opts) do |bldr| if opts[:bibdata] && (doctype || subdoctype || !trialuse.nil? || editorialgroup || ics.any? || standard_status || standard_modified || pubstatus || holdstatus) ext = bldr.ext do |b| doctype&.to_xml b b.subdoctype subdoctype if subdoctype b.send :"trial-use", trialuse unless trialuse.nil? editorialgroup&.to_xml(b) ics.each { |ic| ic.to_xml(b) } b.standard_status standard_status if standard_status b.standard_modified standard_modified if standard_modified b.pubstatus pubstatus if pubstatus b.holdstatus holdstatus if holdstatus end ext["schema-version"] = ext_schema unless opts[:embedded] end end end |