Class: Shhh::App::Args
- Inherits:
-
Object
- Object
- Shhh::App::Args
- Defined in:
- lib/shhh/app/args.rb
Constant Summary collapse
- OPTIONS_REQUIRE_KEY =
%i(encrypt decrypt edit)
- OPTIONS_KEY_CREATED =
%i(generate)
- OPTIONS_SPECIFY_KEY =
%i(private_key interactive keyfile keychain)
- OPTIONS_SPECIFY_OUTPUT =
%i(output quiet)
Instance Attribute Summary collapse
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#selected_options ⇒ Object
Returns the value of attribute selected_options.
Instance Method Summary collapse
- #generate_key? ⇒ Boolean
-
#initialize(opts) ⇒ Args
constructor
A new instance of Args.
- #output_class ⇒ Object
- #require_key? ⇒ Boolean
- #specify_key? ⇒ Boolean
Constructor Details
#initialize(opts) ⇒ Args
Returns a new instance of Args.
13 14 15 16 |
# File 'lib/shhh/app/args.rb', line 13 def initialize(opts) self.opts = opts self. = opts.keys.reject { |k| !opts[k] } end |
Instance Attribute Details
#opts ⇒ Object
Returns the value of attribute opts.
11 12 13 |
# File 'lib/shhh/app/args.rb', line 11 def opts @opts end |
#selected_options ⇒ Object
Returns the value of attribute selected_options.
11 12 13 |
# File 'lib/shhh/app/args.rb', line 11 def @selected_options end |
Instance Method Details
#generate_key? ⇒ Boolean
26 27 28 |
# File 'lib/shhh/app/args.rb', line 26 def generate_key? do?(OPTIONS_KEY_CREATED) end |
#output_class ⇒ Object
30 31 32 33 |
# File 'lib/shhh/app/args.rb', line 30 def output_class output_type = OPTIONS_SPECIFY_OUTPUT.find { |o| opts[o] } # includes nil Shhh::App::Output.outputs[output_type] end |
#require_key? ⇒ Boolean
22 23 24 |
# File 'lib/shhh/app/args.rb', line 22 def require_key? do?(OPTIONS_REQUIRE_KEY) end |
#specify_key? ⇒ Boolean
18 19 20 |
# File 'lib/shhh/app/args.rb', line 18 def specify_key? do?(OPTIONS_SPECIFY_KEY) end |