Class: RSpec::Core::DrbOptions

### Home Classes Methods

### In Files

- lib/rspec/core/drb_options.rb

### Parent

Object

### Methods

- ::new
- #add_failure_exit_code
- #add_filter
- #add_formatters
- #add_full_description
- #add_libs
- #add_line_numbers
- #add_requires
- #options

### Class/Module Index

Quicksearch

- RSpec
- RSpec::Core
- RSpec::Core::BacktraceCleaner
- RSpec::Core::BacktraceFormatter
- RSpec::Core::CommandLine
- RSpec::Core::Configuration
- RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError
- RSpec::Core::ConfigurationOptions
- RSpec::Core::ConstMissing
- RSpec::Core::DRbCommandLine
- RSpec::Core::DSL
- RSpec::Core::Deprecation
- RSpec::Core::DrbOptions
- RSpec::Core::Example
- RSpec::Core::Example::NotPendingExampleFixed
- RSpec::Core::Example::Procsy
- RSpec::Core::ExampleGroup
- RSpec::Core::Extensions
- RSpec::Core::Extensions::InstanceEvalWithArgs
- RSpec::Core::Extensions::ModuleEvalWithArgs
- RSpec::Core::Extensions::Ordered
- RSpec::Core::Extensions::Ordered::ExampleGroups
- RSpec::Core::Extensions::Ordered::Examples
- RSpec::Core::FilterManager
- RSpec::Core::FilterManager::BackwardCompatibility
- RSpec::Core::FilterManager::Describable
- RSpec::Core::Formatters
- RSpec::Core::Formatters::BaseFormatter
- RSpec::Core::Formatters::BaseTextFormatter
- RSpec::Core::Formatters::DeprecationFormatter
- RSpec::Core::Formatters::DocumentationFormatter
- RSpec::Core::Formatters::Helpers
- RSpec::Core::Formatters::HtmlFormatter
- RSpec::Core::Formatters::HtmlPrinter
- RSpec::Core::Formatters::JsonFormatter
- RSpec::Core::Formatters::ProgressFormatter
- RSpec::Core::Formatters::SnippetExtractor
- RSpec::Core::Formatters::SnippetExtractor::NullConverter
- RSpec::Core::Formatters::TextMateFormatter
- RSpec::Core::Hooks
- RSpec::Core::Hooks::AfterAllHook
- RSpec::Core::Hooks::AfterHook
- RSpec::Core::Hooks::AroundHook
- RSpec::Core::Hooks::AroundHookCollection
- RSpec::Core::Hooks::BeforeHook
- RSpec::Core::Hooks::GroupHookCollection
- RSpec::Core::Hooks::Hook
- RSpec::Core::Hooks::HookCollection
- RSpec::Core::Hooks::HookCollectionAliases
- RSpec::Core::Hooks::RegistersGlobals
- RSpec::Core::MemoizedHelpers
- RSpec::Core::MemoizedHelpers::BeforeAllMemoizedHash
- RSpec::Core::MemoizedHelpers::ClassMethods
- RSpec::Core::Metadata
- RSpec::Core::Metadata::ExampleMetadataHash
- RSpec::Core::Metadata::GroupMetadataHash
- RSpec::Core::Metadata::MetadataHash
- RSpec::Core::MetadataHashBuilder
- RSpec::Core::MetadataHashBuilder::Common
- RSpec::Core::MetadataHashBuilder::WithConfigWarning
- RSpec::Core::MetadataHashBuilder::WithDeprecationWarning
- RSpec::Core::MockFrameworkAdapter
- RSpec::Core::Parser
- RSpec::Core::Pending
- RSpec::Core::Pending::PendingDeclaredInExample
- RSpec::Core::Pending::PendingExampleFixedError
- RSpec::Core::ProjectInitializer
- RSpec::Core::RakeTask
- RSpec::Core::Reporter
- RSpec::Core::RubyProject
- RSpec::Core::Runner
- RSpec::Core::SharedContext
- RSpec::Core::SharedExampleGroup
- RSpec::Core::SharedExampleGroup::Collection
- RSpec::Core::SharedExampleGroup::Registry
- RSpec::Core::SharedExampleGroup::TopLevelDSL
- RSpec::Core::Time
- RSpec::Core::Version
- RSpec::Core::World
- RSpec::Rake
- RSpec::Runner
- Autotest
- Autotest::Rspec2
- Kernel

No matching classes.

# RSpec::Core::DrbOptions

@private

### Constants

CONDITIONAL_FILTERS

### Public Class Methods

new(submitted_options, filter_manager) click to toggle source

    # File lib/rspec/core/drb_options.rb, line 6
    def initialize(submitted_options, filter_manager)
      @submitted_options = submitted_options
      @filter_manager = filter_manager
    end

### Public Instance Methods

add_failure_exit_code(argv) click to toggle source

    # File lib/rspec/core/drb_options.rb, line 33
    def add_failure_exit_code(argv)
      if @submitted_options[:failure_exit_code]
        argv << "--failure-exit-code" << @submitted_options[:failure_exit_code].to_s
      end
    end

add_filter(argv, name, hash) click to toggle source

    # File lib/rspec/core/drb_options.rb, line 59
    def add_filter(argv, name, hash)
      hash.each_pair do |k, v|
        next if CONDITIONAL_FILTERS.include?(k)
        tag = name == :inclusion ? k.to_s : "~#{k}"
        tag << ":#{v}" if v.is_a?(String)
        argv << "--tag" << tag
      end unless hash.empty?
    end

add_formatters(argv) click to toggle source

    # File lib/rspec/core/drb_options.rb, line 68
    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) click to toggle source

    # File lib/rspec/core/drb_options.rb, line 39
    def add_full_description(argv)
      if @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
    end

add_libs(argv) click to toggle source

    # File lib/rspec/core/drb_options.rb, line 75
    def add_libs(argv)
      @submitted_options[:libs].each do |path|
        argv << "-I" << path
      end if @submitted_options[:libs]
    end

add_line_numbers(argv) click to toggle source

    # File lib/rspec/core/drb_options.rb, line 51
    def add_line_numbers(argv)
      if @submitted_options[:line_numbers]
        argv.push(*@submitted_options[:line_numbers].inject([]){|a,l| a << "--line_number" << l})
      end
    end

add_requires(argv) click to toggle source

    # File lib/rspec/core/drb_options.rb, line 81
    def add_requires(argv)
      @submitted_options[:requires].each do |path|
        argv << "--require" << path
      end if @submitted_options[:requires]
    end

options() click to toggle source

    # File lib/rspec/core/drb_options.rb, line 11
    def options
      argv = []
      argv << "--color"        if @submitted_options[:color]
      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_full_description(argv)
      add_line_numbers(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

[Validate]

Generated with the Darkfish Rdoc Generator 2.