Class: Integer
Instance Method Summary collapse
- #itb ⇒ Object
-
#to_bits(length = nil) ⇒ Object
convert bit string.
- #to_even_length_hex ⇒ Object
Instance Method Details
#itb ⇒ Object
205 206 207 |
# File 'lib/bitcoin.rb', line 205 def itb to_even_length_hex.htb end |
#to_bits(length = nil) ⇒ Object
convert bit string
210 211 212 213 214 215 216 |
# File 'lib/bitcoin.rb', line 210 def to_bits(length = nil ) if length to_s(2).rjust(length, '0') else to_s(2) end end |
#to_even_length_hex ⇒ Object
200 201 202 203 |
# File 'lib/bitcoin.rb', line 200 def to_even_length_hex hex = to_s(16) hex.rjust((hex.length / 2.0).ceil * 2, '0') end |