Class: Scale::Types::EthereumAddress
- Inherits:
-
Object
- Object
- Scale::Types::EthereumAddress
show all
- Includes:
- Base
- Defined in:
- lib/scale/types.rb
Instance Attribute Summary
Attributes included from Base
#value
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Base
#==, included, #initialize, #to_human
Class Method Details
.decode(scale_bytes) ⇒ Object
715
716
717
718
719
720
|
# File 'lib/scale/types.rb', line 715
def self.decode(scale_bytes)
puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
bytes = scale_bytes.get_next_bytes(20)
puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
new(bytes.bytes_to_hex)
end
|
Instance Method Details
#encode ⇒ Object
722
723
724
725
726
727
728
|
# File 'lib/scale/types.rb', line 722
def encode
if value.start_with?("0x") && value.length == 42
value[2..]
else
raise 'Value should start with "0x" and must be 20 bytes long'
end
end
|