Class: Etheruby::Encoders::String

Inherits:
Base
  • Object
show all
Defined in:
lib/etheruby/encoders/string.rb

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Etheruby::Encoders::Base

Instance Method Details

#decodeObject



11
12
13
14
# File 'lib/etheruby/encoders/string.rb', line 11

def decode
  v, s = Bytes.new(data).decode
  return v.pack('U*'), s
end

#encodeObject



7
8
9
# File 'lib/etheruby/encoders/string.rb', line 7

def encode
  Bytes.new(data.codepoints).encode
end