Class: SeccompTools::Asm::Scalar::ConstVal

Inherits:
Base
  • Object
show all
Defined in:
lib/seccomp-tools/asm/scalar.rb

Overview

A constant value, i.e. an immediate operand.

Instance Attribute Summary

Attributes inherited from Base

#val

Instance Method Summary collapse

Methods inherited from Base

#a?, #data?, #len?, #mem?, #x?

Constructor Details

#initialize(val) ⇒ ConstVal

Instantiates a SeccompTools::Asm::Scalar::ConstVal object.

Parameters:

  • val (Integer)

    The constant value.



96
97
98
99
# File 'lib/seccomp-tools/asm/scalar.rb', line 96

def initialize(val)
  @val = val
  super()
end

Instance Method Details

#==(other) ⇒ Boolean

Compares by value, so a SeccompTools::Asm::Scalar::ConstVal equals the bare Integer it wraps.

Parameters:

  • other (ConstVal, Integer)

    The object to be compared with.

Returns:

  • (Boolean)


106
107
108
# File 'lib/seccomp-tools/asm/scalar.rb', line 106

def ==(other)
  to_i == other.to_i
end

#const?Boolean

Returns Always true.

Returns:

  • (Boolean)

    Always true.



111
112
113
# File 'lib/seccomp-tools/asm/scalar.rb', line 111

def const?
  true
end