Class: Hexdump::Type Private
- Inherits:
-
Object
- Object
- Hexdump::Type
- Defined in:
- lib/hexdump/type.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Char, Float, Float32, Float64, Int, Int16, Int32, Int64, Int8, UChar, UInt, UInt16, UInt32, UInt64, UInt8
Constant Summary collapse
- NATIVE_ENDIAN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The native endian-ness.
if [0x1].pack('I') == [0x1].pack('N') :big else :little end
Instance Attribute Summary collapse
-
#endian ⇒ :little, ...
readonly
private
The endian-ness of the type.
-
#size ⇒ 1, ...
readonly
private
The size in bytes of the type.
Instance Method Summary collapse
-
#initialize(size:, endian: nil, signed:) ⇒ Type
constructor
private
Initializes the type.
-
#signed? ⇒ Boolean
private
Whether the type is signed.
-
#unsigned? ⇒ Boolean
private
Whether the type is unsigned.
Constructor Details
#initialize(size:, endian: nil, signed:) ⇒ Type
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the type.
34 35 36 37 38 |
# File 'lib/hexdump/type.rb', line 34 def initialize(size: , endian: nil, signed: ) @endian = endian @size = size @signed = signed end |
Instance Attribute Details
#endian ⇒ :little, ... (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The endian-ness of the type.
12 13 14 |
# File 'lib/hexdump/type.rb', line 12 def endian @endian end |
#size ⇒ 1, ... (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The size in bytes of the type.
17 18 19 |
# File 'lib/hexdump/type.rb', line 17 def size @size end |
Instance Method Details
#signed? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether the type is signed.
45 46 47 |
# File 'lib/hexdump/type.rb', line 45 def signed? @signed end |
#unsigned? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether the type is unsigned.
54 55 56 |
# File 'lib/hexdump/type.rb', line 54 def unsigned? !@signed end |