Class: ABI::FixedBytes

Inherits:
Type
  • Object
show all
Defined in:
lib/abicoder/types.rb

Overview

class Bytes

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#dynamic?, parse

Constructor Details

#initialize(length) ⇒ FixedBytes

Returns a new instance of FixedBytes.



54
55
56
# File 'lib/abicoder/types.rb', line 54

def initialize( length )
  @length = length   # in bytes (1,2,...32)
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



53
54
55
# File 'lib/abicoder/types.rb', line 53

def length
  @length
end

Instance Method Details

#==(another_type) ⇒ Object



59
60
61
# File 'lib/abicoder/types.rb', line 59

def ==(another_type)
   another_type.kind_of?( FixedBytes ) && @length == another_type.length
end

#formatObject



58
# File 'lib/abicoder/types.rb', line 58

def format() "bytes#{@length}"; end

#sizeObject

note: always uses 32 bytes (with padding)



57
# File 'lib/abicoder/types.rb', line 57

def size()  32; end