class Hexdump::Type

@api private

@since 1.0.0

Constants

NATIVE_ENDIAN

The native endian-ness.

Attributes

endian[R]

The endian-ness of the type.

@return [:little, :big, nil]

size[R]

The size in bytes of the type.

@return [1, 2, 4, 8]

Public Class Methods

new(size: , endian: nil, signed: ) click to toggle source

Initializes the type.

@param [Symbol] name

@param [:little, :big, nil] endian

@param [1, 2, 4, 8] size

@param [Boolean] signed

@raise [ArgumentError]

Invalid `endian:` or `size:` values.
# File lib/hexdump/type.rb, line 33
def initialize(size: , endian: nil, signed: )
  @endian = endian
  @size   = size
  @signed = signed
end

Public Instance Methods

signed?() click to toggle source

Whether the type is signed.

@return [Boolean]

# File lib/hexdump/type.rb, line 44
def signed?
  @signed
end
unsigned?() click to toggle source

Whether the type is unsigned.

@return [Boolean]

# File lib/hexdump/type.rb, line 53
def unsigned?
  !@signed
end