Class: RelatonOgc::OgcBibliographicItem
- Inherits:
-
RelatonBib::BibliographicItem
- Object
- RelatonBib::BibliographicItem
- RelatonOgc::OgcBibliographicItem
- Defined in:
- lib/relaton_ogc/ogc_bibliographic_item.rb
Constant Summary collapse
- TYPES =
%w[ abstract-specification-topic best-practice change-request-supporting-document community-practice community-standard discussion-paper engineering-report other policy reference-model release-notes standard user-guide white-paper test-suite ].freeze
- 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.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 17 def initialize(**args) if args[:subdoctype] && !SUBTYPES.include?(args[:subdoctype]) warn "[relaton-ogc] WARNING: invalid document "\ "subtype: #{args[:subdoctype]}" end # @docsubtype = args.delete :docsubtype # @doctype = args.delete :doctype super end |
Class Method Details
.from_hash(hash) ⇒ RelatonOgc::OgcBibliographicItem
39 40 41 42 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 39 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
33 34 35 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 33 def ext_schema @ext_schema ||= schema_versions["relaton-model-ogc"] end |
#to_xml(**opts) ⇒ String
Returns XML.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 57 def to_xml(**opts) # rubocop:disable Metrics/AbcSize super(**opts) do |b| ext = b.ext do b.doctype doctype if doctype 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 |