Sha256: 08185194093f5cebd3c45462a8cd3162fb28cc12ea6c9b6a716c1549986827ae
Contents?: true
Size: 1.98 KB
Versions: 9
Compression:
Stored size: 1.98 KB
Contents
module RelatonOgc class OgcBibliographicItem < RelatonBib::BibliographicItem 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 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 # @param hash [Hash] # @return [RelatonOgc::OgcBibliographicItem] def self.from_hash(hash) item_hash = ::RelatonOgc::HashConverter.hash_to_bib(hash) new(**item_hash) end # @return [Hash] # def to_hash # hash = super # hash["docsubtype"] = docsubtype if docsubtype # hash # end # @param opts [Hash] # @option opts [Nokogiri::XML::Builder] :builder XML builder # @option opts [Boolean] :bibdata # @option opts [Symbol, NilClass] :date_format (:short), :full # @option opts [String, Symbol] :lang language # @return [String] XML def to_xml(**opts) super(**opts) do |b| 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 end end # @param prefix [String] # @return [String] # def to_asciibib(prefix = "") # pref = prefix.empty? ? prefix : prefix + "." # out = super # out += "#{pref}docsubtype:: #{docsubtype}\n" if docsubtype # out # end end end
Version data entries
9 entries across 9 versions & 1 rubygems