class Integer

Public Instance Methods

itb() click to toggle source
# File lib/tapyrus.rb, line 181
def itb
  to_even_length_hex.htb
end
to_bits(length = nil) click to toggle source

convert bit string

# File lib/tapyrus.rb, line 186
def to_bits(length = nil)
  length ? to_s(2).rjust(length, '0') : to_s(2)
end
to_even_length_hex() click to toggle source
# File lib/tapyrus.rb, line 176
def to_even_length_hex
  hex = to_s(16)
  hex.rjust((hex.length / 2.0).ceil * 2, '0')
end