Class: Sigma::ErgoBoxCandidates
- Inherits:
-
Object
- Object
- Sigma::ErgoBoxCandidates
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/ergo_box.rb
Overview
An ordered collection of ErgoBoxCandidate
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.create ⇒ ErgoBoxCandidates
Create an empty collection.
-
.with_raw_pointer(pointer) ⇒ ErgoBoxCandidates
Takes ownership of an existing ErgoBoxCandidates Pointer.
Instance Method Summary collapse
-
#add(ergo_box_candidate) ⇒ Object
Add to collection.
-
#get(index) ⇒ ErgoBoxCandidate?
Get item at specified index or return nil if no item exists.
-
#len ⇒ Integer
Get length of collection.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
263 264 265 |
# File 'lib/sigma/ergo_box.rb', line 263 def pointer @pointer end |
Class Method Details
.create ⇒ ErgoBoxCandidates
Create an empty collection
267 268 269 270 271 272 |
# File 'lib/sigma/ergo_box.rb', line 267 def self.create pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_ergo_box_candidates_new(pointer) init(pointer) end |
.with_raw_pointer(pointer) ⇒ ErgoBoxCandidates
Note:
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing ErgoBoxCandidates Pointer.
278 279 280 |
# File 'lib/sigma/ergo_box.rb', line 278 def self.with_raw_pointer(pointer) init(pointer) end |
Instance Method Details
#add(ergo_box_candidate) ⇒ Object
Add to collection
290 291 292 |
# File 'lib/sigma/ergo_box.rb', line 290 def add(ergo_box_candidate) ergo_lib_ergo_box_candidates_add(ergo_box_candidate.pointer, self.pointer) end |
#get(index) ⇒ ErgoBoxCandidate?
Get item at specified index or return nil if no item exists
297 298 299 300 301 302 303 304 305 306 |
# File 'lib/sigma/ergo_box.rb', line 297 def get(index) pointer = FFI::MemoryPointer.new(:pointer) res = ergo_lib_ergo_box_candidates_get(self.pointer, index, pointer) Util.check_error!(res[:error]) if res[:is_some] Sigma::ErgoBoxCandidate.with_raw_pointer(pointer) else nil end end |
#len ⇒ Integer
Get length of collection
284 285 286 |
# File 'lib/sigma/ergo_box.rb', line 284 def len ergo_lib_ergo_box_candidates_len(self.pointer) end |