Class: Uncov::Configuration
- Inherits:
-
Object
- Object
- Uncov::Configuration
- Defined in:
- lib/uncov/configuration.rb
Overview
handle configuration for uncov
Defined Under Namespace
Classes: Option
Constant Summary collapse
- CONFIG_FILE =
'.uncov'- FILE_MATCH_FLAGS =
equivalent of ‘shopt -s extglob dotglob globstar` for testing with `bash` & `ls`
File::FNM_EXTGLOB | File::FNM_PATHNAME | File::FNM_DOTMATCH
Class Method Summary collapse
- .option(name, description, options:, default:, allowed_values: nil, value_parse: ->(value) { value }) ⇒ Object
- .options ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #options_values ⇒ Object
- #parse_cli(args) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
42 43 44 45 |
# File 'lib/uncov/configuration.rb', line 42 def initialize parse_config end |
Class Method Details
.option(name, description, options:, default:, allowed_values: nil, value_parse: ->(value) { value }) ⇒ Object
13 14 15 16 17 |
# File 'lib/uncov/configuration.rb', line 13 def option(name, description, options:, default:, allowed_values: nil, value_parse: ->(value) { value }) self. << [name, description, , default, allowed_values, value_parse] define_method(name) { self.[name].value } define_method("#{name}=") { |value| self.[name].value = value } end |
.options ⇒ Object
19 |
# File 'lib/uncov/configuration.rb', line 19 def = @options ||= [] |
Instance Method Details
#options_values ⇒ Object
48 |
# File 'lib/uncov/configuration.rb', line 48 def = .to_h { |name, option| [name.to_sym, option.value] } |
#parse_cli(args) ⇒ Object
47 |
# File 'lib/uncov/configuration.rb', line 47 def parse_cli(args) = parser.parse!(args) |