Class: RelatonBsi::BsiBibliographicItem

Inherits:
RelatonIsoBib::IsoBibliographicItem
  • Object
show all
Defined in:
lib/relaton_bsi/bsi_bibliographic_item.rb

Constant Summary collapse

SUBDOCTYPES =
%w[specification method-of-test method-of-specifying vocabulary code-of-practice].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ BsiBibliographicItem

rubocop:disable Metrics/AbcSize



5
6
7
8
9
10
11
# File 'lib/relaton_bsi/bsi_bibliographic_item.rb', line 5

def initialize(**args) # rubocop:disable Metrics/AbcSize
  if args[:subdoctype] && !SUBDOCTYPES.include?(args[:subdoctype])
    Util.warn "invalid subdoctype: `#{args[:subdoctype]}`"
    Util.warn "Allowed subdoctypes are: `#{SUBDOCTYPES.join('`, `')}`"
  end
  super
end

Class Method Details

.from_hash(hash) ⇒ RelatonBsi::BsiBibliographicItem

Parameters:

  • hash (Hash)

Returns:



46
47
48
49
# File 'lib/relaton_bsi/bsi_bibliographic_item.rb', line 46

def self.from_hash(hash)
  item_hash = ::RelatonBsi::HashConverter.hash_to_bib(hash)
  new(**item_hash)
end

Instance Method Details

#ext_schemaString

Fetch flavor schema version

Returns:

  • (String)

    flavor schema version



18
19
20
# File 'lib/relaton_bsi/bsi_bibliographic_item.rb', line 18

def ext_schema
  @ext_schema ||= schema_versions["relaton-model-bsi"]
end