Module: EthereumTree::Utils

Defined in:
lib/ethereum_tree/utils.rb

Class Method Summary collapse

Class Method Details

.padding64(str) ⇒ Object



7
8
9
10
11
12
# File 'lib/ethereum_tree/utils.rb', line 7

def self.padding64(str)
  if str =~ /^0x[a-f0-9]*/
    str = str[2 .. str.length-1]
  end
  str.rjust(64, '0')
end

.prefix_hex(hex) ⇒ Object



3
4
5
# File 'lib/ethereum_tree/utils.rb', line 3

def self.prefix_hex(hex)
  hex.match(/\A0x/) ? hex : "0x#{hex}"
end