Class: Pubid::Etsi::Components::Version

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

Overview

Represents an ETSI version string Format: V1.2.3, V2.0.0, or ed.1

Instance Method Summary collapse

Constructor Details

#initialize(version:, is_edition: false) ⇒ Version

true for ed.N format



16
17
18
19
# File 'lib/pubid/etsi/components/version.rb', line 16

def initialize(version:, is_edition: false)
  @version = version
  @is_edition = is_edition
end

Instance Method Details

#==(other) ⇒ Object



29
30
31
32
33
# File 'lib/pubid/etsi/components/version.rb', line 29

def ==(other)
  return false unless other.is_a?(Version)

  version == other.version && is_edition == other.is_edition
end

#to_sObject



21
22
23
24
25
26
27
# File 'lib/pubid/etsi/components/version.rb', line 21

def to_s
  if is_edition
    "ed.#{version}"
  else
    "V#{version}"
  end
end