module Web3::Eth::Utility

Public Instance Methods

from_hex(h) click to toggle source
# File lib/web3ethereum/utility.rb, line 14
def from_hex h
  h.to_i 16
end
hex(num) click to toggle source
# File lib/web3ethereum/utility.rb, line 6
def hex num
  '0x' + num.to_s(16)
end
remove_0x_head(s) click to toggle source
# File lib/web3ethereum/utility.rb, line 18
def remove_0x_head(s)
  s[0,2] == '0x' ? s[2..-1] : s
end
wei_to_ether(wei) click to toggle source
# File lib/web3ethereum/utility.rb, line 10
def wei_to_ether(wei)
  1.0 * wei / 10**18
end