Exception: Optimize::Codec::UnmatchedIBFVersion

Inherits:
StandardError
  • Object
show all
Defined in:
lib/optimize/codec.rb

Overview

Raised when the IBF header’s version stamp does not match the version this codec was written against. The CRuby loader makes the same check and raises “unmatched version file”; mirror that behavior here so a cross-version binary fails at decode with a clear error instead of producing nonsense.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected_major:, expected_minor:, actual_major:, actual_minor:) ⇒ UnmatchedIBFVersion

Returns a new instance of UnmatchedIBFVersion.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/optimize/codec.rb', line 59

def initialize(expected_major:, expected_minor:, actual_major:, actual_minor:)
  @expected_major = expected_major
  @expected_minor = expected_minor
  @actual_major   = actual_major
  @actual_minor   = actual_minor
  super(
    "IBF version mismatch: codec targets Ruby #{expected_major}.#{expected_minor}, " \
    "binary has #{actual_major}.#{actual_minor}. Recompile the source with the " \
    "targeted Ruby, or port the codec to this Ruby version."
  )
end

Instance Attribute Details

#actual_majorObject (readonly)

Returns the value of attribute actual_major.



57
58
59
# File 'lib/optimize/codec.rb', line 57

def actual_major
  @actual_major
end

#actual_minorObject (readonly)

Returns the value of attribute actual_minor.



57
58
59
# File 'lib/optimize/codec.rb', line 57

def actual_minor
  @actual_minor
end

#expected_majorObject (readonly)

Returns the value of attribute expected_major.



57
58
59
# File 'lib/optimize/codec.rb', line 57

def expected_major
  @expected_major
end

#expected_minorObject (readonly)

Returns the value of attribute expected_minor.



57
58
59
# File 'lib/optimize/codec.rb', line 57

def expected_minor
  @expected_minor
end