Class: Tapyrus::PSTT::KeyValue

Inherits:
Struct
  • Object
show all
Defined in:
lib/tapyrus/pstt.rb

Overview

A single key-value record of a PSTT map.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keydataObject

Returns the value of attribute keydata

Returns:

  • (Object)

    the current value of keydata



94
95
96
# File 'lib/tapyrus/pstt.rb', line 94

def keydata
  @keydata
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



94
95
96
# File 'lib/tapyrus/pstt.rb', line 94

def type
  @type
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



94
95
96
# File 'lib/tapyrus/pstt.rb', line 94

def value
  @value
end

Instance Method Details

#keyString

The complete key( and ). Records are unique by this value within a map.

Returns:

  • (String)

    the complete key with binary format.



98
99
100
# File 'lib/tapyrus/pstt.rb', line 98

def key
  Tapyrus.pack_var_int(type) + keydata
end

#to_payloadObject



102
103
104
105
# File 'lib/tapyrus/pstt.rb', line 102

def to_payload
  k = key
  Tapyrus.pack_var_int(k.bytesize) + k + Tapyrus.pack_var_int(value.bytesize) + value
end