Class: OpenPGP::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/openpgp/engine.rb,
lib/openpgp/engine/gnupg.rb,
lib/openpgp/engine/openssl.rb

Direct Known Subclasses

Engine::GnuPG, Engine::OpenSSL

Defined Under Namespace

Classes: GnuPG, OpenSSL

Class Method Summary (collapse)

Class Method Details

+ (Boolean) available?

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
# File 'lib/openpgp/engine.rb', line 9

def self.available?
  begin
    load!(true)
    return true
  rescue LoadError => e
    return false
  end
end

+ install!

This method returns an undefined value.

Raises:

  • (LoadError)


29
30
31
# File 'lib/openpgp/engine.rb', line 29

def self.install!
  load!
end

+ install_extensions!(extension) (protected)

This method returns an undefined value.

Parameters:

  • (Module) extension


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/openpgp/engine.rb', line 47

def self.install_extensions!(extension)
  name = extension.name.split('::').last.to_sym

  klass = OpenPGP.const_get(name)
  extension.constants.each do |const|
    klass.send(:remove_const, const)
    klass.const_set(const, extension.const_get(const))
  end

  target = (class << klass; self; end)
  extension.instance_methods(false).each do |method|
    target.send(:remove_method, method)
    target.send(:include, extension)
  end
end

+ load!(reload = false)

This method returns an undefined value.

Parameters:

  • (Boolean) reload (defaults to: false)

Raises:

  • (LoadError)


22
23
24
# File 'lib/openpgp/engine.rb', line 22

def self.load!(reload = false)
  raise LoadError
end

+ use {|engine| ... }

This method returns an undefined value.

Yields:

  • (engine)

Yield Parameters:



37
38
39
40
# File 'lib/openpgp/engine.rb', line 37

def self.use(&block)
  load!
  block.call(self)
end