Module: EtherMultipliable

Included in:
Bignum, Fixnum, Float, Integer
Defined in:
lib/etheruby/ether_multipliable.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/etheruby/ether_multipliable.rb', line 15

def method_missing(sym)
  if ETHER_MULTIPLES.has_key? sym
    return self * ETHER_MULTIPLES[sym]
  else
    raise NoMethodError.new
  end
end

Instance Method Details

#from_wei(sym) ⇒ Object



23
24
25
# File 'lib/etheruby/ether_multipliable.rb', line 23

def from_wei(sym)
  return self / ETHER_MULTIPLES[sym].to_f
end