Class: Pubid::Iec::Components::TrfInfo

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/pubid/iec/components/trf_info.rb

Overview

TRF Info component for Test Report Form specific metadata Single Responsibility: Represents TRF-specific publishing information Example: IECEE TRF or IECEx TRF publications

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Check if TRF info is empty (no data)

Returns:

  • (Boolean)


24
25
26
# File 'lib/pubid/iec/components/trf_info.rb', line 24

def empty?
  publisher.nil? && series.nil? && version.nil?
end

#to_sObject



15
16
17
18
19
20
21
# File 'lib/pubid/iec/components/trf_info.rb', line 15

def to_s
  parts = []
  parts << publisher if publisher
  parts << series if series
  parts << "Ver.#{version}" if version
  parts.join(" ")
end

#validate!Object

Validate that at least publisher or series is present



29
30
31
32
33
34
# File 'lib/pubid/iec/components/trf_info.rb', line 29

def validate!
  if empty?
    raise ArgumentError,
          "TrfInfo must have at least publisher or series"
  end
end