Class: Sigma::ErgoBoxAssetsDataList

Inherits:
Object
  • Object
show all
Extended by:
FFI::Library
Defined in:
lib/sigma/ergo_box.rb

Overview

An ordered collection of ErgoBoxAssetsData

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



670
671
672
# File 'lib/sigma/ergo_box.rb', line 670

def pointer
  @pointer
end

Class Method Details

.createErgoBoxAssetsDataList

Create an empty collection



682
683
684
685
686
687
# File 'lib/sigma/ergo_box.rb', line 682

def self.create
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_ergo_box_assets_data_list_new(pointer)

  init(pointer)
end

.with_raw_pointer(unread_pointer) ⇒ ErgoBoxAssetsDataList

Note:

A user of sigma_rb generally does not need to call this function

Takes ownership of an existing ErgoBoxAssetsDataList Pointer.

Parameters:

  • pointer (FFI::MemoryPointer)

Returns:



676
677
678
# File 'lib/sigma/ergo_box.rb', line 676

def self.with_raw_pointer(unread_pointer)
  init(unread_pointer)
end

Instance Method Details

#add(ergo_box_assets_data) ⇒ Object

Add to collection

Parameters:



697
698
699
# File 'lib/sigma/ergo_box.rb', line 697

def add(ergo_box_assets_data)
  ergo_lib_ergo_box_assets_data_list_add(ergo_box_assets_data.pointer, self.pointer)
end

#get(index) ⇒ ErgoBoxAssetsData?

Get item at specified index or return nil if no item exists

Parameters:

  • index (Integer)

Returns:



704
705
706
707
708
709
710
711
712
713
# File 'lib/sigma/ergo_box.rb', line 704

def get(index)
  pointer = FFI::MemoryPointer.new(:pointer)
  res = ergo_lib_ergo_box_assets_data_list_get(self.pointer, index, pointer)
  Util.check_error!(res[:error])
  if res[:is_some]
    Sigma::ErgoBoxAssetsData.with_raw_pointer(pointer)
  else
    nil
  end
end

#lenInteger

Get length of collection

Returns:

  • (Integer)


691
692
693
# File 'lib/sigma/ergo_box.rb', line 691

def len
  ergo_lib_ergo_box_assets_data_list_len(self.pointer)
end