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
Instance Attribute Summary collapse
- #docsubtype ⇒ String readonly
Instance Method Summary collapse
-
#initialize(**args) ⇒ OgcBibliographicItem
constructor
A new instance of OgcBibliographicItem.
- #to_asciibib(prefix = "") ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder = nil, **opts) ⇒ Object
Constructor Details
#initialize(**args) ⇒ OgcBibliographicItem
Returns a new instance of OgcBibliographicItem.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 21 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 |
Instance Attribute Details
#docsubtype ⇒ String (readonly)
18 19 20 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 18 def docsubtype @docsubtype end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ String
55 56 57 58 59 60 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 55 def to_asciibib(prefix = "") pref = prefix.empty? ? prefix : prefix + "." out = super out += "#{pref}docsubtype:: #{docsubtype}\n" if docsubtype out end |
#to_hash ⇒ Hash
33 34 35 36 37 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 33 def to_hash hash = super hash["docsubtype"] = docsubtype if docsubtype hash end |
#to_xml(builder = nil, **opts) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/relaton_ogc/ogc_bibliographic_item.rb', line 42 def to_xml(builder = nil, **opts) super 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 |