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.
- #has_ext? ⇒ Boolean
-
#initialize(**args) ⇒ IeeeBibliographicItem
constructor
A new instance of IeeeBibliographicItem.
- #to_asciibib(prefix = "") ⇒ String
-
#to_bibxml(builder = nil, include_keywords: false) ⇒ String, Nokogiri::XML::Builder::NodeBuilder
Render BibXML (RFC).
-
#to_hash(embedded: false) ⇒ Hash
Rnder as Hash.
-
#to_xml(**opts) ⇒ String
XML.
Constructor Details
#initialize(**args) ⇒ IeeeBibliographicItem
Returns a new instance of IeeeBibliographicItem.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 27 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)
8 9 10 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 8 def editorialgroup @editorialgroup end |
#holdstatus ⇒ String? (readonly)
14 15 16 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 14 def holdstatus @holdstatus end |
#pubstatus ⇒ String? (readonly)
14 15 16 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 14 def pubstatus @pubstatus end |
#standard_modified ⇒ String? (readonly)
14 15 16 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 14 def standard_modified @standard_modified end |
#standard_status ⇒ String? (readonly)
14 15 16 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 14 def standard_status @standard_status end |
#trialuse ⇒ Boolean? (readonly)
Returns Trial use.
11 12 13 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 11 def trialuse @trialuse end |
Class Method Details
.from_hash(hash) ⇒ RelatonIeee::IeeeBibliographicItem
53 54 55 56 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 53 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
47 48 49 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 47 def ext_schema @ext_schema ||= schema_versions["relaton-model-ieee"] end |
#has_ext? ⇒ Boolean
100 101 102 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 100 def has_ext? super || !trialuse.nil? || standard_status || standard_modified || pubstatus || holdstatus end |
#to_asciibib(prefix = "") ⇒ String
106 107 108 109 110 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 106 def to_asciibib(prefix = "") out = super out += "#{prefix}.trialuse:: #{trialuse}\n" unless trialuse.nil? out end |
#to_bibxml(builder = nil, include_keywords: false) ⇒ String, Nokogiri::XML::Builder::NodeBuilder
Render BibXML (RFC)
120 121 122 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 120 def to_bibxml(builder = nil, include_keywords: false) Renderer::BibXML.new(self).render builder: builder, include_keywords: include_keywords end |
#to_hash(embedded: false) ⇒ Hash
Rnder as Hash
90 91 92 93 94 95 96 97 98 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 90 def to_hash(embedded: false) # rubocop:disable Metrics/AbcSize hash = super hash["ext"]["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.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/relaton_ieee/ieee_bibliographic_item.rb', line 63 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 |