Class: Sigma::SecretKeys
- Inherits:
-
Object
- Object
- Sigma::SecretKeys
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/secret_key.rb
Overview
An ordered collection of SecretKey
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.create ⇒ SecretKeys
Create an empty collection.
-
.with_raw_pointer(unread_pointer) ⇒ SecretKeys
Takes ownership of an existing SecretKeys Pointer.
Instance Method Summary collapse
-
#add(secret_key) ⇒ Object
Add to collection.
-
#get(index) ⇒ SecretKey?
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.
89 90 91 |
# File 'lib/sigma/secret_key.rb', line 89 def pointer @pointer end |
Class Method Details
.create ⇒ SecretKeys
Create an empty collection
101 102 103 104 105 106 |
# File 'lib/sigma/secret_key.rb', line 101 def self.create pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_secret_keys_new(pointer) init(pointer) end |
.with_raw_pointer(unread_pointer) ⇒ SecretKeys
Note:
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing SecretKeys Pointer.
95 96 97 |
# File 'lib/sigma/secret_key.rb', line 95 def self.with_raw_pointer(unread_pointer) init(unread_pointer) end |
Instance Method Details
#add(secret_key) ⇒ Object
Add to collection
116 117 118 |
# File 'lib/sigma/secret_key.rb', line 116 def add(secret_key) ergo_lib_secret_keys_add(secret_key.pointer, self.pointer) end |
#get(index) ⇒ SecretKey?
Get item at specified index or return nil if no item exists
123 124 125 126 127 128 129 130 131 132 |
# File 'lib/sigma/secret_key.rb', line 123 def get(index) pointer = FFI::MemoryPointer.new(:pointer) res = ergo_lib_secret_keys_get(self.pointer, index, pointer) Util.check_error!(res[:error]) if res[:is_some] Sigma::SecretKey.with_raw_pointer(pointer) else nil end end |
#len ⇒ Integer
Get length of collection
110 111 112 |
# File 'lib/sigma/secret_key.rb', line 110 def len ergo_lib_secret_keys_len(self.pointer) end |