Class: RelatonIho::IhoBibliographicItem
- Inherits:
-
RelatonBib::BibliographicItem
- Object
- RelatonBib::BibliographicItem
- RelatonIho::IhoBibliographicItem
- Defined in:
- lib/relaton_iho/iho_bibliographic_item.rb
Constant Summary collapse
- TYPES =
%w[policy-and-procedures best-practices supporting-document report legal directives proposal standard].freeze
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**args) ⇒ IhoBibliographicItem
constructor
A new instance of IhoBibliographicItem.
- #to_asciibib(prefix = "") ⇒ String
- #to_hash ⇒ Hash
-
#to_xml(**opts) ⇒ String
XML.
Constructor Details
#initialize(**args) ⇒ IhoBibliographicItem
Returns a new instance of IhoBibliographicItem.
11 12 13 14 |
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 11 def initialize(**args) @commentperiod = args.delete :commentperiod super end |
Instance Attribute Details
#commentperiod ⇒ RelatonIho::CommentPeriod, NilClass (readonly)
7 8 9 |
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 7 def commentperiod @commentperiod end |
Class Method Details
.from_hash(hash) ⇒ RelatonIho::IhoBibliographicItem
18 19 20 21 |
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 18 def self.from_hash(hash) item_hash = ::RelatonIho::HashConverter.hash_to_bib(hash) new **item_hash end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ String
51 52 53 54 55 |
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 51 def to_asciibib(prefix = "") out = super out += commentperiod.to_asciibib prefix if commentperiod out end |
#to_hash ⇒ Hash
43 44 45 46 47 |
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 43 def to_hash hash = super hash["commentperiod"] = commentperiod.to_hash if commentperiod hash end |
#to_xml(**opts) ⇒ String
Returns XML.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 28 def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity super ext: !commentperiod.nil?, **opts do |b| if opts[:bibdata] && (doctype || editorialgroup&.presence? || ics.any? || commentperiod) b.ext do b.doctype doctype if doctype editorialgroup&.to_xml b ics.each { |i| i.to_xml b } commentperiod&.to_xml b end end end end |