Sha256: e78ef717743350f507062845d76723283d09e893e23107581fa937bc388e96a2
Contents?: true
Size: 921 Bytes
Versions: 10
Compression:
Stored size: 921 Bytes
Contents
module Sym module App class Args 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) attr_accessor :opts, :selected_options def initialize(opts) self.opts = opts self.selected_options = opts.keys.reject { |k| !opts[k] } end def specify_key? do?(OPTIONS_SPECIFY_KEY) end def require_key? do?(OPTIONS_REQUIRE_KEY) end def generate_key? do?(OPTIONS_KEY_CREATED) end def output_class output_type = OPTIONS_SPECIFY_OUTPUT.find { |o| opts[o] } # includes nil Sym::App::Output.outputs[output_type] end private def do?(list) !(list & selected_options).empty? end end end end
Version data entries
10 entries across 10 versions & 1 rubygems