Class: RapidVaults
- Inherits:
-
Object
- Object
- RapidVaults
- Defined in:
- lib/rapid_vaults.rb
Overview
interfaces from cli/api, validates settings, and then distributes actions to appropriate classes
Defined Under Namespace
Class Method Summary collapse
-
.process(settings) ⇒ Object
method for processing the settings and inputs.
Instance Method Summary collapse
-
#main(settings) ⇒ Object
main runner for software.
Class Method Details
.process(settings) ⇒ Object
method for processing the settings and inputs
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rapid_vaults.rb', line 23 def self.process(settings) # default to openssl algorithm and `pwd` output directory if settings[:ui] == :cli # :outdir only relevant for :cli settings[:outdir] ||= Dir.pwd settings[:outdir] += '/' unless settings[:outdir][-1] == '/' end return if settings[:action] == :binding settings[:algorithm] ||= :openssl # check for problems with arguments and inputs public_send(:"process_#{settings[:algorithm]}", settings) end |
Instance Method Details
#main(settings) ⇒ Object
main runner for software
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rapid_vaults.rb', line 9 def main(settings) # process settings via pass-by-reference self.class.process(settings) # execute desired action and algorithm via dynamic call case settings[:action] when :generate then Generate.public_send(settings[:algorithm], settings) when :encrypt then Encrypt.public_send(settings[:algorithm], settings) when :decrypt then Decrypt.public_send(settings[:algorithm], settings) when :binding then Binding.public_send(settings[:binding], settings) end end |