Class: CertBot::Parameter::ParameterRepository
- Inherits:
-
RubyUtils::Parameter::BaseParameterRepository
- Object
- RubyUtils::Parameter::BaseParameterRepository
- CertBot::Parameter::ParameterRepository
- Defined in:
- lib/cert_bot/parameter/parameter_repository.rb
Overview
Parameter repository to store the valid parameters of the script. #initialize gets the provided parameters and fills a hash which grants access to the provided parameters and arguments.
Instance Method Summary collapse
-
#define_mapping ⇒ Object
private
method to define the input string values that will match a given paramter symbol.
-
#process_argument(arg) ⇒ Object
private
method to read further argument and process it depending on its content.
Instance Method Details
#define_mapping ⇒ Object (private)
method to define the input string values that will match a given paramter symbol
29 30 31 32 33 34 |
# File 'lib/cert_bot/parameter/parameter_repository.rb', line 29 def define_mapping @mapping[:debug] = ["-d", "--debug"] @mapping[:json] = ["-j", "--json"] @mapping[:severity] = ["-s", "--severity"] @mapping[:updated] = ["-u", "--updated"] end |
#process_argument(arg) ⇒ Object (private)
method to read further argument and process it depending on its content
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cert_bot/parameter/parameter_repository.rb', line 16 def process_argument(arg) case arg when *@mapping[:debug] then @parameters[:debug] = true when *@mapping[:json] then create_argument_entry(:json) when *@mapping[:severity] then create_argument_entry(:severity) when *@mapping[:updated] then @parameters[:updated] = true else raise_invalid_parameter(arg) end nil end |