Module: Ironclad::Cache

Defined in:
lib/ironclad/cache.rb,
lib/ironclad/cache/null.rb,
lib/ironclad/cache/keyctl.rb,
lib/ironclad/cache/keychain.rb

Overview

Selects the OS keystore backend for the current platform.

Defined Under Namespace

Classes: Keychain, Keyctl, Null

Class Method Summary collapse

Class Method Details

.for_platform(account, host_os = RbConfig::CONFIG['host_os']) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/ironclad/cache.rb', line 13

def for_platform(, host_os = RbConfig::CONFIG['host_os'])
  case host_os
  when /darwin/
    Keychain.new()
  when /linux/
    keyctl_available? ? Keyctl.new : Null.new
  else
    Null.new
  end
end

.keyctl_available?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/ironclad/cache.rb', line 24

def keyctl_available?
  system('command -v keyctl', out: File::NULL, err: File::NULL)
end