Module: Tem::Builders::Crypto::Impl

Defined in:
lib/tem/builders/crypto.rb

Overview

Implementation code for the Crypto methods.

Class Method Summary collapse

Class Method Details

.key_from_array(array, offset, ssl_class, abi_type) ⇒ Object



118
119
120
121
122
# File 'lib/tem/builders/crypto.rb', line 118

def self.key_from_array(array, offset, ssl_class, abi_type)
  key = ssl_class.new
  numbers = self.send :"read_#{abi_type}", array, offset
  numbers.each { |k, v| key.send :"#{k}=", v }
end

.key_to_array(key, abi_type) ⇒ Object



124
125
126
127
128
# File 'lib/tem/builders/crypto.rb', line 124

def self.key_to_array(key, abi_type)
  components = self.send :"#{abi_type}_components"
  numbers = Hash[*(components.map { |c| [c, key.send(c.to_sym) ]}.flatten)]
  self.send :"to_#{abi_type}", numbers
end