Class: RelatonOgc::OgcBibliographicItem
- Inherits:
-
RelatonBib::BibliographicItem
- Object
- RelatonBib::BibliographicItem
- RelatonOgc::OgcBibliographicItem
- Defined in:
- lib/relaton_ogc/ogc_bibliographic_item.rb
Constant Summary collapse
- SUBTYPES =
%w[ conceptual-model conceptual-model-and-encoding conceptual-model-and-implementation encoding extension implementation profile profile-with-extension general ].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#ext_schema ⇒ String
Fetches flavof schema version.
-
#initialize(**args) ⇒ OgcBibliographicItem
constructor
A new instance of OgcBibliographicItem.
-
#to_xml(**opts) ⇒ String
XML.
Constructor Details
#initialize(**args) ⇒ OgcBibliographicItem
Returns a new instance of OgcBibliographicItem.
9 10 11 12 13 14 15 16 17 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 9 def initialize(**args) if args[:subdoctype] && !SUBTYPES.include?(args[:subdoctype]) Util.warn "Invalid document subtype: `#{args[:subdoctype]}`" end # @docsubtype = args.delete :docsubtype # @doctype = args.delete :doctype super end |
Class Method Details
.from_hash(hash) ⇒ RelatonOgc::OgcBibliographicItem
30 31 32 33 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 30 def self.from_hash(hash) item_hash = ::RelatonOgc::HashConverter.hash_to_bib(hash) new(**item_hash) end |
Instance Method Details
#ext_schema ⇒ String
Fetches flavof schema version
24 25 26 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 24 def ext_schema @ext_schema ||= schema_versions["relaton-model-ogc"] end |
#to_xml(**opts) ⇒ String
Returns XML.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 48 def to_xml(**opts) # rubocop:disable Metrics/AbcSize super(**opts) do |b| ext = b.ext do doctype&.to_xml b b.subdoctype subdoctype if subdoctype editorialgroup&.to_xml b ics.each { |i| i.to_xml b } end ext["schema-version"] = ext_schema unless opts[:embedded] end end |