Class: Borsh::ByteString

Inherits:
Object
  • Object
show all
Defined in:
lib/borsh/byte_string.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, length) ⇒ ByteString

Returns a new instance of ByteString.



2
3
4
5
# File 'lib/borsh/byte_string.rb', line 2

def initialize(value, length)
  @value = value
  @length = length
end

Instance Method Details

#to_borshObject



7
8
9
10
11
# File 'lib/borsh/byte_string.rb', line 7

def to_borsh
  raise Borsh::ArgumentError, 'ByteString length mismatch' if value.size != length

  value
end