Class: RelatonNist::NistBibliographicItem
- Inherits:
-
RelatonBib::BibliographicItem
- Object
- RelatonBib::BibliographicItem
- RelatonNist::NistBibliographicItem
- Defined in:
- lib/relaton_nist/nist_bibliographic_item.rb
Instance Attribute Summary collapse
- #commentperiod ⇒ RelatonNist::CommentPeriod, NilClass readonly
- #doctype ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**args) ⇒ NistBibliographicItem
constructor
A new instance of NistBibliographicItem.
- #to_asciibib(prefix = "") ⇒ String
- #to_hash ⇒ Hash
-
#to_xml(**opts) ⇒ String
XML.
Constructor Details
#initialize(**args) ⇒ NistBibliographicItem
Returns a new instance of NistBibliographicItem.
58 59 60 61 62 63 64 |
# File 'lib/relaton_nist/nist_bibliographic_item.rb', line 58 def initialize(**args) # @doctype = args.delete(:doctype) || "standard" # args[:doctype] ||= "standard" # @keyword = args.delete(:keyword) || [] @commentperiod = args.delete :commentperiod super end |
Instance Attribute Details
#commentperiod ⇒ RelatonNist::CommentPeriod, NilClass (readonly)
10 11 12 |
# File 'lib/relaton_nist/nist_bibliographic_item.rb', line 10 def commentperiod @commentperiod end |
#doctype ⇒ String (readonly)
4 5 6 |
# File 'lib/relaton_nist/nist_bibliographic_item.rb', line 4 def doctype @doctype end |
Class Method Details
.from_hash(hash) ⇒ RelatonNist::GbBibliographicItem
68 69 70 71 |
# File 'lib/relaton_nist/nist_bibliographic_item.rb', line 68 def self.from_hash(hash) item_hash = RelatonNist::HashConverter.hash_to_bib(hash) new **item_hash end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ String
99 100 101 102 103 |
# File 'lib/relaton_nist/nist_bibliographic_item.rb', line 99 def to_asciibib(prefix = "") out = super out += commentperiod.to_asciibib prefix if commentperiod out end |
#to_hash ⇒ Hash
90 91 92 93 94 95 |
# File 'lib/relaton_nist/nist_bibliographic_item.rb', line 90 def to_hash hash = super # hash["keyword"] = single_element_array(keyword) if keyword&.any? hash["commentperiod"] = commentperiod.to_hash if commentperiod hash end |
#to_xml(**opts) ⇒ String
Returns XML.
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/relaton_nist/nist_bibliographic_item.rb', line 78 def to_xml(**opts) super date_format: :short, **opts do |b| if opts[:bibdata] b.ext do b.doctype doctype if doctype commentperiod&.to_xml b end end end end |