123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Core::DRbOptions Private

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: rspec-core/lib/rspec/core/drb.rb

Constant Summary

Class Method Summary

Instance Method Summary

Instance Method Details

#add_error_exit_code(argv)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/drb.rb', line 71

def add_error_exit_code(argv)
  return unless @submitted_options[:error_exit_code]

  argv << "--error-exit-code" << @submitted_options[:error_exit_code].to_s
end

#add_failure_exit_code(argv)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/drb.rb', line 65

def add_failure_exit_code(argv)
  return unless @submitted_options[:failure_exit_code]

  argv << "--failure-exit-code" << @submitted_options[:failure_exit_code].to_s
end

#add_filter(argv, name, hash)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/drb.rb', line 91

def add_filter(argv, name, hash)
  hash.each_pair do |k, v|
    next if CONDITIONAL_FILTERS.include?(k)
    tag = name == :inclusion ? k.to_s.dup : "~#{k}".dup
    tag << ":#{v}" if v.is_a?(String)
    argv << "--tag" << tag
  end unless hash.empty?
end

#add_formatters(argv)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/drb.rb', line 100

def add_formatters(argv)
  @submitted_options[:formatters].each do |pair|
    argv << "--format" << pair[0]
    argv << "--out" << pair[1] if pair[1]
  end if @submitted_options[:formatters]
end

#add_full_description(argv)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/drb.rb', line 77

def add_full_description(argv)
  return unless @submitted_options[:full_description]

  # The argument to --example is regexp-escaped before being stuffed
  # into a regexp when received for the first time (see OptionParser).
  # Hence, merely grabbing the source of this regexp will retain the
  # backslashes, so we must remove them.
  @submitted_options[:full_description].each do |description|
    argv << "--example" << description.source.delete('\\')
  end
end

#add_libs(argv)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/drb.rb', line 107

def add_libs(argv)
  @submitted_options[:libs].each do |path|
    argv << "-I" << path
  end if @submitted_options[:libs]
end

#add_requires(argv)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/drb.rb', line 113

def add_requires(argv)
  @submitted_options[:requires].each do |path|
    argv << "--require" << path
  end if @submitted_options[:requires]
end

#options

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/drb.rb', line 41

def options
  argv = []
  argv << "--color"        if @submitted_options[:color]
  argv << "--force-color"  if @submitted_options[:color_mode] == :on
  argv << "--no-color"     if @submitted_options[:color_mode] == :off
  argv << "--profile"      if @submitted_options[:profile_examples]
  argv << "--backtrace"    if @submitted_options[:full_backtrace]
  argv << "--tty"          if @submitted_options[:tty]
  argv << "--fail-fast"    if @submitted_options[:fail_fast]
  argv << "--options"      << @submitted_options[:custom_options_file] if @submitted_options[:custom_options_file]
  argv << "--order"        << @submitted_options[:order]               if @submitted_options[:order]

  add_failure_exit_code(argv)
  add_error_exit_code(argv)
  add_full_description(argv)
  add_filter(argv, :inclusion, @filter_manager.inclusions)
  add_filter(argv, :exclusion, @filter_manager.exclusions)
  add_formatters(argv)
  add_libs(argv)
  add_requires(argv)

  argv + @submitted_options[:files_or_directories_to_run]
end