Top Level Namespace

Includes:
CRUDJT::Validation

Defined Under Namespace

Modules: CRUDJT, Token Classes: TokenServiceImpl

Constant Summary

Constants included from CRUDJT::Validation

CRUDJT::Validation::ERROR_ALREADY_STARTED, CRUDJT::Validation::ERROR_MESSAGES, CRUDJT::Validation::ERROR_NOT_STARTED, CRUDJT::Validation::ERROR_SECRET_KEY_NOT_SET, CRUDJT::Validation::MAX_HASH_SIZE, CRUDJT::Validation::MIN_SILENCE_READ, CRUDJT::Validation::MIN_TTL, CRUDJT::Validation::U64_MAX

Instance Method Summary collapse

Methods included from CRUDJT::Validation

#error_message, #validate_hash_bytesize!, #validate_insertion!, #validate_secret_key!, #validate_token!

Instance Method Details

#load_store_jt_libraryObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/crudjt.rb', line 14

def load_store_jt_library
  os = case RbConfig::CONFIG['host_os']
       when /darwin|mac os/
         'macos'
       when /linux/
         'linux'
       when /mswin|mingw|cygwin/
         'windows'
       else
         raise "Unsupported OS: #{RbConfig::CONFIG['host_os']}"
       end

   arch = case RbConfig::CONFIG['host_cpu']
        when /x86_64|x64/
          'x86_64'
        when /arm|arm64|aarch64/
          'arm64'
        else
          raise "Unsupported architecture: #{RbConfig::CONFIG['host_cpu']}"
        end

  lib_path = File.expand_path("../native/#{os}/store_jt_#{arch}", __FILE__)
  lib_path += '.dylib' if os == 'macos'
  lib_path += '.so' if os == 'linux'
  lib_path += '.dll' if os == 'windows'

  ffi_lib lib_path
end