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
170 171 172 |
# File 'lib/tapyrus.rb', line 170 def itb to_even_length_hex.htb end |
#to_bits(length = nil) ⇒ Object
convert bit string
175 176 177 |
# File 'lib/tapyrus.rb', line 175 def to_bits(length = nil) length ? to_s(2).rjust(length, "0") : to_s(2) end |
#to_even_length_hex ⇒ Object
165 166 167 168 |
# File 'lib/tapyrus.rb', line 165 def to_even_length_hex hex = to_s(16) hex.rjust((hex.length / 2.0).ceil * 2, "0") end |