Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/wwmd/class_extensions/extensions_rbkb.rb
Overview
Mixins and class-specific items
Class Method Summary collapse
- .from_l16(str) ⇒ Object
- .from_l32(str) ⇒ Object
- .from_l8(str) ⇒ Object
- .from_n16(str) ⇒ Object
- .from_n32(str) ⇒ Object
- .from_n8(str) ⇒ Object
Instance Method Summary collapse
- #to_b16 ⇒ Object (also: #to_n16)
- #to_b32 ⇒ Object (also: #to_n32)
- #to_l16 ⇒ Object
-
#to_l32 ⇒ Object
:nodoc:.
- #to_l8 ⇒ Object
- #to_n8 ⇒ Object
- #to_u8 ⇒ Object
Class Method Details
.from_l16(str) ⇒ Object
27 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 27 def self.from_l16(str); (str.unpack "v")[0]; end |
.from_l32(str) ⇒ Object
28 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 28 def self.from_l32(str); (str.unpack "V")[0]; end |
.from_l8(str) ⇒ Object
26 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 26 def self.from_l8(str); str[0]; end |
.from_n16(str) ⇒ Object
30 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 30 def self.from_n16(str); (str.unpack "n")[0]; end |
.from_n32(str) ⇒ Object
31 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 31 def self.from_n32(str); (str.unpack "N")[0]; end |
.from_n8(str) ⇒ Object
29 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 29 def self.from_n8(str); str[0]; end |
Instance Method Details
#to_b16 ⇒ Object Also known as: to_n16
17 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 17 def to_b16; [self].pack "n"; end |
#to_b32 ⇒ Object Also known as: to_n32
15 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 15 def to_b32; [self].pack "N"; end |
#to_l16 ⇒ Object
16 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 16 def to_l16; [self].pack "v"; end |
#to_l32 ⇒ Object
:nodoc:
14 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 14 def to_l32; [self].pack "L"; end |
#to_l8 ⇒ Object
19 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 19 def to_l8; chr; end |
#to_n8 ⇒ Object
20 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 20 def to_n8; chr; end |
#to_u8 ⇒ Object
18 |
# File 'lib/wwmd/class_extensions/extensions_rbkb.rb', line 18 def to_u8; [self].pack "C"; end |