Class: RSpec::Core::ConfigurationOptions
- Inherits:
-
Object
- Object
- RSpec::Core::ConfigurationOptions
- Defined in:
- lib/rspec/core/configuration_options.rb
Overview
Responsible for utilizing externally provided configuration options,
whether via the command line, .rspec
, ~/.rspec
, .rspec-local
or a custom options file.
Instance Attribute Summary collapse
-
#args ⇒ Array<String>
readonly
The original command-line arguments.
-
#options ⇒ Hash
readonly
The final merged options, drawn from all external sources.
Instance Method Summary collapse
-
#configure(config) ⇒ void
Updates the provided Configuration instance based on the provided external configuration options.
-
#configure_filter_manager(filter_manager) ⇒ void
private
Updates the provided FilterManager based on the filter options.
-
#initialize(args) ⇒ ConfigurationOptions
constructor
A new instance of ConfigurationOptions.
Constructor Details
#initialize(args) ⇒ ConfigurationOptions
Returns a new instance of ConfigurationOptions.
11 12 13 14 |
# File 'lib/rspec/core/configuration_options.rb', line 11 def initialize(args) @args = args.dup end |
Instance Attribute Details
#args ⇒ Array<String> (readonly)
Returns the original command-line arguments.
39 40 41 |
# File 'lib/rspec/core/configuration_options.rb', line 39 def args @args end |
#options ⇒ Hash (readonly)
Returns the final merged options, drawn from all external sources.
36 37 38 |
# File 'lib/rspec/core/configuration_options.rb', line 36 def @options end |
Instance Method Details
#configure(config) ⇒ void
Updates the provided RSpec::Core::Configuration instance based on the provided external configuration options.
20 21 22 23 24 |
# File 'lib/rspec/core/configuration_options.rb', line 20 def configure(config) config configure_filter_manager config.filter_manager load_formatters_into config end |
#configure_filter_manager(filter_manager) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Updates the provided FilterManager based on the filter options.
29 30 31 32 33 |
# File 'lib/rspec/core/configuration_options.rb', line 29 def configure_filter_manager(filter_manager) @filter_manager_options.each do |command, value| filter_manager.__send__ command, value end end |