Class: Udb::ExceptionCode

Inherits:
TopLevelDatabaseObject show all
Extended by:
T::Sig
Includes:
Comparable, Code
Defined in:
lib/udb/obj/exception_code.rb

Overview

a synchroncous exception code

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Udb::TopLevelDatabaseObject

Instance Method Details

#<=>(other) ⇒ Integer?

Parameters:

  • other (BasicObject)

Returns:

  • (Integer, nil)


49
50
51
52
53
# File 'lib/udb/obj/exception_code.rb', line 49

def <=>(other)
  return nil unless T.cast(other, Object).is_a?(ExceptionCode)

  num <=> T.cast(other, ExceptionCode).num
end

#display_nameString Originally defined in module Code

Returns Long-form display name (can include special characters).

Returns:

  • (String)

    Long-form display name (can include special characters)

#eql?(other) ⇒ Boolean

Parameters:

  • other (BasicObject)

Returns:

  • (Boolean)


56
57
58
# File 'lib/udb/obj/exception_code.rb', line 56

def eql?(other)
  (self <=> other) == 0
end

#hashInteger

Returns:

  • (Integer)


61
# File 'lib/udb/obj/exception_code.rb', line 61

def hash = [ExceptionCode, num].hash

#numInteger Originally defined in module Code

Returns Code, written into *mcause.

Returns:

  • (Integer)

    Code, written into *mcause

#validate(resolver)

This method returns an undefined value.

Parameters:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/udb/obj/exception_code.rb', line 36

def validate(resolver)
  super(resolver)

  @arch.exception_codes.each do |code|
    next if code == self

    if num == code.num
      raise ValidationError, "Duplicate exception code #{num} for #{name}, #{code.name}"
    end
  end
end

#varString Originally defined in module Code

Returns Field name for an IDL enum.

Returns:

  • (String)

    Field name for an IDL enum