Class: RSpecTurbo::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_turbo/options.rb

Overview

Splits the raw ARGV into RSpec options and target folders/files, and pulls out –exclude-pattern values for the file discovery step.

The tricky part is knowing which flags consume the next token as a value (so it is not mistaken for a folder); OPTIONS_WITH_VALUES lists those.

Constant Summary collapse

OPTIONS_WITH_VALUES =
Set.new(%w[
  --exclude-pattern --pattern --format --require --order --seed
  --tag --failure-exit-code --backtrace-exclusion-pattern
]).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Options

Returns a new instance of Options.



17
18
19
20
# File 'lib/rspec_turbo/options.rb', line 17

def initialize(argv)
  @rspec_options, @folders = parse(argv)
  @exclude_patterns = extract_exclude_patterns(@rspec_options)
end

Instance Attribute Details

#exclude_patternsObject (readonly)

Returns the value of attribute exclude_patterns.



15
16
17
# File 'lib/rspec_turbo/options.rb', line 15

def exclude_patterns
  @exclude_patterns
end

#foldersObject (readonly)

Returns the value of attribute folders.



15
16
17
# File 'lib/rspec_turbo/options.rb', line 15

def folders
  @folders
end

#rspec_optionsObject (readonly)

Returns the value of attribute rspec_options.



15
16
17
# File 'lib/rspec_turbo/options.rb', line 15

def rspec_options
  @rspec_options
end