Module: Eth::RLP::Encode
- Defined in:
- lib/ethruby/rlp/encode.rb
Defined Under Namespace
Classes: InputOverflow
Class Method Summary collapse
Class Method Details
.encode(input) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ethruby/rlp/encode.rb', line 10 def encode(input) result = if input.is_a?(String) encode_string(input) elsif input.is_a?(Array) encode_list(input) elsif input.is_a?(Numeric) to_binary(input) elsif input == true to_binary(0x01) elsif input == false to_binary(0x80) else raise ArgumentError.new('input must be a String or Array') end result.b end |