Class: RelatonBsi::BsiBibliographicItem
- Inherits:
-
RelatonIsoBib::IsoBibliographicItem
- Object
- RelatonIsoBib::IsoBibliographicItem
- RelatonBsi::BsiBibliographicItem
- Defined in:
- lib/relaton_bsi/bsi_bibliographic_item.rb
Constant Summary collapse
- DOCTYPES =
%w[ british-standard draft-for-development published-document privately-subscribed-standard publicly-available-specification flex-standard international-standard technical-specification technical-report guide international-workshop-agreement industry-technical-agreement standard european-workshop-agreement fast-track-standard ].freeze
- SUBDOCTYPES =
%w[specification method-of-test method-of-specifying vocabulary code-of-practice].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#ext_schema ⇒ String
Fetch flavor schema version.
-
#initialize(**args) ⇒ BsiBibliographicItem
constructor
A new instance of BsiBibliographicItem.
-
#to_xml(**opts) ⇒ String
XML.
Constructor Details
#initialize(**args) ⇒ BsiBibliographicItem
Returns a new instance of BsiBibliographicItem.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/relaton_bsi/bsi_bibliographic_item.rb', line 14 def initialize(**args) # rubocop:disable Metrics/AbcSize # if args[:doctype] && !TYPES.include?(args[:doctype]) # warn "[relaton-bsi] WARNING: invalid doctype: #{args[:doctype]}" # warn "[relaton-bsi] Allowed doctypes are: #{TYPES.join(', ')}" # end if args[:subdoctype] && !SUBDOCTYPES.include?(args[:subdoctype]) warn "[relaton-bsi] WARNING: invalid subdoctype: #{args[:subdoctype]}" warn "[relaton-bsi] Allowed subdoctypes are: #{SUBDOCTYPES.join(', ')}" end super end |
Class Method Details
.from_hash(hash) ⇒ RelatonBsi::BsiBibliographicItem
58 59 60 61 |
# File 'lib/relaton_bsi/bsi_bibliographic_item.rb', line 58 def self.from_hash(hash) item_hash = ::RelatonBsi::HashConverter.hash_to_bib(hash) new(**item_hash) end |
Instance Method Details
#ext_schema ⇒ String
Fetch flavor schema version
31 32 33 |
# File 'lib/relaton_bsi/bsi_bibliographic_item.rb', line 31 def ext_schema @ext_schema ||= schema_versions["relaton-model-bsi"] end |
#to_xml(**opts) ⇒ String
Returns XML.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/relaton_bsi/bsi_bibliographic_item.rb', line 40 def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity super(**opts) do |b| if opts[:bibdata] && (has_ext_attrs? || price_code || !cen_processing.nil?) ext = b.ext do b.doctype doctype if doctype b.horizontal horizontal unless horizontal.nil? editorialgroup&.to_xml b ics.each { |i| i.to_xml b } structuredidentifier&.to_xml b b.stagename stagename if stagename end ext["schema-version"] = ext_schema unless opts[:embeded] end end end |