Class: RelatonIec::IecBibliographicItem
- Inherits:
-
RelatonIsoBib::IsoBibliographicItem
- Object
- RelatonIsoBib::IsoBibliographicItem
- RelatonIec::IecBibliographicItem
- Defined in:
- lib/relaton_iec/iec_bibliographic_item.rb
Constant Summary collapse
- TYPES =
%w[ international-standard technical-specification technical-report publicly-available-specification international-workshop-agreement guide industry-technical-agreement system-reference-delivrabble ].freeze
- FUNCTION =
%w[emc safety enviroment quality-assurance].freeze
Instance Attribute Summary collapse
- #accessibility_color_inside ⇒ Boolean? readonly
- #cen_processing ⇒ Boolean? readonly
- #function ⇒ String? readonly
- #interest_to_committees ⇒ String? readonly
- #price_code ⇒ String? readonly
- #secretary ⇒ String? readonly
- #updates_document_type ⇒ String? readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#ext_schema ⇒ String
Fetch flavor schema version.
-
#initialize(**args) ⇒ IecBibliographicItem
constructor
attr_reader :tc_sc_officers_note.
- #to_hash ⇒ Hash
-
#to_xml(**opts) ⇒ String
XML.
Constructor Details
#initialize(**args) ⇒ IecBibliographicItem
attr_reader :tc_sc_officers_note
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 20 def initialize(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength if args[:function] && !FUNCTION.include?(args[:function]) warn "[relaton-iec] WARNING: invalid function \"#{args[:function]}\"" warn "[relaton-iec] allowed function values are: #{FUNCTION.join(', ')}" end if args[:updates_document_type] && !TYPES.include?(args[:updates_document_type]) warn "[relaton-iec] WARNING: invalid updates_document_type "\ "\"#{args[:updates_document_type]}\"" warn "[relaton-iec] allowed updates_document_type values are: "\ "#{TYPES.join(', ')}" end @function = args.delete :function @updates_document_type = args.delete :updates_document_type @accessibility_color_inside = args.delete :accessibility_color_inside @price_code = args.delete :price_code @cen_processing = args.delete :cen_processing @secretary = args.delete :secretary @interest_to_committees = args.delete :interest_to_committees super end |
Instance Attribute Details
#accessibility_color_inside ⇒ Boolean? (readonly)
16 17 18 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 16 def accessibility_color_inside @accessibility_color_inside end |
#cen_processing ⇒ Boolean? (readonly)
16 17 18 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 16 def cen_processing @cen_processing end |
#function ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 12 def function @function end |
#interest_to_committees ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 12 def interest_to_committees @interest_to_committees end |
#price_code ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 12 def price_code @price_code end |
#secretary ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 12 def secretary @secretary end |
#updates_document_type ⇒ String? (readonly)
12 13 14 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 12 def updates_document_type @updates_document_type end |
Class Method Details
.from_hash(hash) ⇒ RelatonIsoBib::IecBibliographicItem
53 54 55 56 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 53 def self.from_hash(hash) item_hash = ::RelatonIec::HashConverter.hash_to_bib(hash) new(**item_hash) end |
Instance Method Details
#ext_schema ⇒ String
Fetch flavor schema version
47 48 49 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 47 def ext_schema schema_versions["relaton-model-iec"] end |
#to_hash ⇒ Hash
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 93 def to_hash # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity hash = super hash["function"] = function if function if updates_document_type hash["updates_document_type"] = updates_document_type end unless accessibility_color_inside.nil? hash["accessibility_color_inside"] = accessibility_color_inside end hash["price_code"] = price_code if price_code hash["cen_processing"] = cen_processing unless cen_processing.nil? hash["secretary"] = secretary if secretary if interest_to_committees hash["interest_to_committees"] = interest_to_committees end hash end |
#to_xml(**opts) ⇒ String
Returns XML.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/relaton_iec/iec_bibliographic_item.rb', line 63 def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity super(**opts) do |b| if opts[:bibdata] ext = b.ext do b.doctype doctype if doctype b.horizontal horizontal unless horizontal.nil? b.function function if function editorialgroup&.to_xml b ics.each { |i| i.to_xml b } structuredidentifier&.to_xml b b.stagename stagename if stagename if updates_document_type b.send(:"updates-document-type", updates_document_type) end unless accessibility_color_inside.nil? b.send(:"accessibility-color-inside", accessibility_color_inside) end b.send(:"price-code", price_code) if price_code b.send(:"cen-processing", cen_processing) unless cen_processing.nil? b.secretary secretary if secretary if interest_to_committees b.send(:"interest-to-committees", interest_to_committees) end end ext["schema-version"] = ext_schema unless opts[:embedded] end end end |