Sha256: dfb3c645dfec2105d1f4723834c18cf3dd2940f3b3d5973f48cbfbdf8f19f82c
Contents?: true
Size: 1.84 KB
Versions: 8
Compression:
Stored size: 1.84 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 # @return [String] attr_reader :docsubtype # @param docsubtype [String] def initialize(**args) if args[:docsubtype] && !SUBTYPES.include?(args[:docsubtype]) warn "[relaton-ogc] WARNING: invalid document "\ "subtype: #{args[:docsubtype]}" end @docsubtype = args.delete :docsubtype # @doctype = args.delete :doctype super 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.docsubtype docsubtype if docsubtype 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
8 entries across 8 versions & 1 rubygems