Class: RelatonIetf::IetfBibliographicItem
- Inherits:
-
RelatonBib::BibliographicItem
- Object
- RelatonBib::BibliographicItem
- RelatonIetf::IetfBibliographicItem
- Defined in:
- lib/relaton_ietf/ietf_bibliographic_item.rb
Constant Summary collapse
- DOCTYPES =
%w[rfc internet-draft].freeze
Instance Attribute Summary collapse
- #doctype ⇒ String, NilClass readonly
- #keyword ⇒ Array<String> readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**args) ⇒ IetfBibliographicItem
constructor
A new instance of IetfBibliographicItem.
-
#to_xml(**opts) ⇒ String
XML.
Constructor Details
#initialize(**args) ⇒ IetfBibliographicItem
Returns a new instance of IetfBibliographicItem.
13 14 15 16 17 18 |
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 13 def initialize(**args) if args[:doctype] && !DOCTYPES.include?(args[:doctype]) warn "[relaton-ietf] WARNING: invalid doctype #{args[:doctype]}" end super end |
Instance Attribute Details
#doctype ⇒ String, NilClass (readonly)
6 7 8 |
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 6 def doctype @doctype end |
#keyword ⇒ Array<String> (readonly)
9 10 11 |
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 9 def keyword @keyword end |
Class Method Details
.from_hash(hash) ⇒ RelatonIetf::IetfBibliographicItem
22 23 24 25 |
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 22 def self.from_hash(hash) item_hash = ::RelatonIetf::HashConverter.hash_to_bib(hash) new(**item_hash) end |
Instance Method Details
#to_xml(**opts) ⇒ String
Returns XML.
33 34 35 36 |
# File 'lib/relaton_ietf/ietf_bibliographic_item.rb', line 33 def to_xml(**opts) opts[:date_format] ||= :short super(**opts) end |