Parent

Class Index [+]

Quicksearch

RSpec::Core::ConfigurationOptions

@private

Constants

NON_FORCED_OPTIONS

Attributes

options[R]

Public Class Methods

new(args) click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 10
10:       def initialize(args)
11:         @args = args
12:       end

Public Instance Methods

configure(config) click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 14
14:       def configure(config)
15:         formatters = options.delete(:formatters)
16: 
17:         config.filter_manager = filter_manager
18: 
19:         order(options.keys, :libs, :requires, :default_path, :pattern).each do |key|
20:           force?(key) ? config.force(key => options[key]) : config.send("#{key}=", options[key])
21:         end
22: 
23:         formatters.each {|pair| config.add_formatter(*pair) } if formatters
24:       end
drb_argv() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 32
32:       def drb_argv
33:         DrbOptions.new(options, filter_manager).options
34:       end
filter_manager() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 36
36:       def filter_manager
37:         @filter_manager ||= RSpec::configuration.filter_manager
38:       end
parse_options() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 26
26:       def parse_options
27:         @options ||= extract_filters_from(*all_configs).inject do |merged, pending|
28:           merged.merge(pending)
29:         end
30:       end

Private Instance Methods

all_configs() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 65
65:       def all_configs
66:         @all_configs ||= file_options << command_line_options << env_options
67:       end
args_from_options_file(path) click to toggle source
     # File lib/rspec/core/configuration_options.rb, line 97
 97:       def args_from_options_file(path)
 98:         return [] unless path && File.exist?(path)
 99:         config_string = options_file_as_erb_string(path)
100:         config_string.split(/\n+/).map {|l| l.shellsplit}.flatten
101:       end
command_line_options() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 77
77:       def command_line_options
78:         @command_line_options ||= Parser.parse!(@args).merge :files_or_directories_to_run => @args
79:       end
custom_options() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 81
81:       def custom_options
82:         options_from(custom_options_file)
83:       end
custom_options_file() click to toggle source
     # File lib/rspec/core/configuration_options.rb, line 107
107:       def custom_options_file
108:         command_line_options[:custom_options_file]
109:       end
env_options() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 73
73:       def env_options
74:         ENV["SPEC_OPTS"] ? Parser.parse!(Shellwords.split(ENV["SPEC_OPTS"])) : {}
75:       end
extract_filters_from(*configs) click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 58
58:       def extract_filters_from(*configs)
59:         configs.compact.each do |config|
60:           filter_manager.include config.delete(:inclusion_filter) if config.has_key?(:inclusion_filter)
61:           filter_manager.exclude config.delete(:exclusion_filter) if config.has_key?(:exclusion_filter)
62:         end
63:       end
file_options() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 69
69:       def file_options
70:         custom_options_file ? [custom_options] : [global_options, local_options]
71:       end
force?(key) click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 47
47:       def force?(key)
48:         !NON_FORCED_OPTIONS.include?(key)
49:       end
global_options() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 89
89:       def global_options
90:         @global_options ||= options_from(global_options_file)
91:       end
global_options_file() click to toggle source
     # File lib/rspec/core/configuration_options.rb, line 115
115:       def global_options_file
116:         begin
117:           File.join(File.expand_path("~"), ".rspec")
118:         rescue ArgumentError
119:           warn "Unable to find ~/.rspec because the HOME environment variable is not set"
120:           nil
121:         end
122:       end
local_options() click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 85
85:       def local_options
86:         @local_options ||= options_from(local_options_file)
87:       end
local_options_file() click to toggle source
     # File lib/rspec/core/configuration_options.rb, line 111
111:       def local_options_file
112:         ".rspec"
113:       end
options_file_as_erb_string(path) click to toggle source
     # File lib/rspec/core/configuration_options.rb, line 103
103:       def options_file_as_erb_string(path)
104:         ERB.new(File.read(path)).result(binding)
105:       end
options_from(path) click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 93
93:       def options_from(path)
94:         Parser.parse(args_from_options_file(path))
95:       end
order(keys, *ordered) click to toggle source
    # File lib/rspec/core/configuration_options.rb, line 51
51:       def order(keys, *ordered)
52:         ordered.reverse.each do |key|
53:           keys.unshift(key) if keys.delete(key)
54:         end
55:         keys
56:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.