Sha256: 822e45b2f5d7a7d3d48aacdecff5b62e7fe82542aae4f57852cacc6ba9f1e23c

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

module RelatonOgc
  class OgcBibliographicItem < RelatonIsoBib::IsoBibliographicItem
    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] invalid document subtype: #{args[:docsubtype]}"
      end

      @docsubtype = args.delete :docsubtype
      super
    end

    # @return [Hash]
    def to_hash
      hash = super
      hash["docsubtype"] = docsubtype if docsubtype
      hash
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
relaton-ogc-1.1.0 lib/relaton_ogc/ogc_bibliographic_item.rb
relaton-ogc-1.0.1 lib/relaton_ogc/ogc_bibliographic_item.rb
relaton-ogc-1.0.0 lib/relaton_ogc/ogc_bibliographic_item.rb
relaton-ogc-0.7.3 lib/relaton_ogc/ogc_bibliographic_item.rb
relaton-ogc-0.7.2 lib/relaton_ogc/ogc_bibliographic_item.rb
relaton-ogc-0.7.1 lib/relaton_ogc/ogc_bibliographic_item.rb