struct

Pampero::Address

Inherits Struct < Value < Object

This represents an address and contains general helper methods. To obtain a workable object, check_format needs to be over- loaded to check that the address' format is correct.

Constructors

new(bytes : Array(UInt8), little : Bool = false)

Turns the list of bytes into an address. little specifies the endianness of those bytes.

Source
new(str : String, little : Bool = false)

Turns a hex string representing an address into an address. little is true if bytes should be stored in little-endian order

Source

Instance methods

bytes
Source
check_format

This should be overloaded to check that the size of the @bytes array corresponds to a valid address.

Source
format_size

This should be overloaded to allocate the right size of bytes into @bytes

Source
format_str

Default address format descriptor, overload if needed.

Source
from_bytes(bytes : Array(UInt8))
Source
hex_str
Source
little
Source
to_i
Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source