Class: Tanker::CTanker::CVerificationList
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Tanker::CTanker::CVerificationList
- Defined in:
- lib/tanker/c_tanker/c_verification.rb
Instance Method Summary collapse
-
#initialize(verifications) ⇒ CVerificationList
constructor
A new instance of CVerificationList.
Constructor Details
#initialize(verifications) ⇒ CVerificationList
Returns a new instance of CVerificationList.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/tanker/c_tanker/c_verification.rb', line 173 def initialize(verifications) super() unless verifications.is_a?(Array) raise TypeError, 'Verifications argument is not an Array[Tanker::Verification]' end self[:version] = 1 self[:count] = verifications.length # NOTE: Instance variables are required to keep the CVerifications alive @verifications = [] self[:verifications] = FFI::MemoryPointer.new(CVerification, self[:count]) verifications.each_with_index do |verification, idx| @verifications.push(CVerification.new(verification)) # NOTE: memcopy str = @verifications[idx].pointer.read_bytes CVerification.size self[:verifications].put_bytes(idx * CVerification.size, str, 0, CVerification.size) end end |