Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/tapyrus.rb
Instance Method Summary collapse
- #itb ⇒ Object
-
#to_bits(length = nil) ⇒ Object
convert bit string.
- #to_even_length_hex ⇒ Object
Instance Method Details
#itb ⇒ Object
167 168 169 |
# File 'lib/tapyrus.rb', line 167 def itb to_even_length_hex.htb end |
#to_bits(length = nil) ⇒ Object
convert bit string
172 173 174 |
# File 'lib/tapyrus.rb', line 172 def to_bits(length = nil) length ? to_s(2).rjust(length, '0') : to_s(2) end |
#to_even_length_hex ⇒ Object
162 163 164 165 |
# File 'lib/tapyrus.rb', line 162 def to_even_length_hex hex = to_s(16) hex.rjust((hex.length / 2.0).ceil * 2, '0') end |