class Cucumber::Runtime

This is the meaty part of Cucumber that ties everything together.

def after(scenario) #:nodoc:

:nodoc:
def after(scenario) #:nodoc:
  @current_scenario = nil
  return if @configuration.dry_run?
  @support_code.fire_hook(:after, scenario)
end

def after_step #:nodoc:

:nodoc:
def after_step #:nodoc:
  return if @configuration.dry_run?
  @support_code.fire_hook(:execute_after_step, @current_scenario)
end

def around(scenario, skip_hooks=false, &block) #:nodoc:

:nodoc:
def around(scenario, skip_hooks=false, &block) #:nodoc:
  if skip_hooks
    yield
    return
  end
  @support_code.around(scenario, block)
end

def before(scenario) #:nodoc:

:nodoc:
def before(scenario) #:nodoc:
  return if @configuration.dry_run? || @current_scenario
  @current_scenario = scenario
  @support_code.fire_hook(:before, scenario)
end

def before_and_after(scenario, skip_hooks=false) #:nodoc:

:nodoc:
def before_and_after(scenario, skip_hooks=false) #:nodoc:
  before(scenario) unless skip_hooks
  yield scenario
  after(scenario) unless skip_hooks
  @results.scenario_visited(scenario)
end

def configure(new_configuration)

Allows you to take an existing runtime and change it's configuration
def configure(new_configuration)
  @configuration = Configuration.parse(new_configuration)
  @support_code.configure(@configuration)
  @results.configure(@configuration)
end

def disable_minitest_test_unit_autorun

def disable_minitest_test_unit_autorun
  MultiTest.disable_autorun
end

def doc_string(string_without_triple_quotes, content_type='', line_offset=0)


Returns Ast::DocString for +string_without_triple_quotes+.
def doc_string(string_without_triple_quotes, content_type='', line_offset=0)
  Ast::DocString.new(string_without_triple_quotes,content_type)
end

def features

def features
  @loader ||= Runtime::FeaturesLoader.new(
    @configuration.feature_files,
    @configuration.filters,
    @configuration.tag_expression)
  @loader.features
end

def features_paths

def features_paths
  @configuration.paths
end

def fire_after_configuration_hook #:nodoc

:nodoc
def fire_after_configuration_hook #:nodoc
  @support_code.fire_hook(:after_configuration, @configuration)
end

def initialize(configuration = Configuration.default)

def initialize(configuration = Configuration.default)
  @current_scenario = nil
  @configuration = Configuration.parse(configuration)
  @support_code = SupportCode.new(self, @configuration)
  @results = Results.new(@configuration)
end

def load_programming_language(language)

def load_programming_language(language)
  @support_code.load_programming_language(language)
end

def load_step_definitions

def load_step_definitions
  files = @configuration.support_to_load + @configuration.step_defs_to_load
  @support_code.load_files!(files)
end

def log

def log
  Cucumber.logger
end

def run!

def run!
  load_step_definitions
  disable_minitest_test_unit_autorun
  fire_after_configuration_hook
  tree_walker = @configuration.build_tree_walker(self)
  self.visitor = tree_walker # Ugly circular dependency, but needed to support World#puts
  tree_walker.visit_features(features)
end

def scenarios(status = nil)

def scenarios(status = nil)
  @results.scenarios(status)
end

def snippet_text(step_keyword, step_name, multiline_arg_class) #:nodoc:

:nodoc:
def snippet_text(step_keyword, step_name, multiline_arg_class) #:nodoc:
  @support_code.snippet_text(Gherkin::I18n.code_keyword_for(step_keyword), step_name, multiline_arg_class)
end

def step_match(step_name, name_to_report=nil) #:nodoc:

:nodoc:
def step_match(step_name, name_to_report=nil) #:nodoc:
  @support_code.step_match(step_name, name_to_report)
end

def step_visited(step) #:nodoc:

:nodoc:
def step_visited(step) #:nodoc:
  @results.step_visited(step)
end

def steps(status = nil)

def steps(status = nil)
  @results.steps(status)
end

def unknown_programming_language?

def unknown_programming_language?
  @support_code.unknown_programming_language?
end

def unmatched_step_definitions

def unmatched_step_definitions
  @support_code.unmatched_step_definitions
end

def with_hooks(scenario, skip_hooks=false)

def with_hooks(scenario, skip_hooks=false)
  around(scenario, skip_hooks) do
    before_and_after(scenario, skip_hooks) do
      yield scenario
    end
  end
end

def write_stepdefs_json

def write_stepdefs_json
  if(@configuration.dotcucumber)
    stepdefs = []
    @support_code.step_definitions.sort{|a,b| a.to_hash['source'] <=> a.to_hash['source']}.each do |stepdef|
      stepdef_hash = stepdef.to_hash
      steps = []
      features.each do |feature|
        feature.feature_elements.each do |feature_element|
          feature_element.raw_steps.each do |step|
            args = stepdef.arguments_from(step.name)
            if(args)
              steps << {
                'name' => step.name,
                'args' => args.map do |arg|
                  {
                    'offset' => arg.offset,
                    'val' => arg.val
                  }
                end
              }
            end
          end
        end
      end
      stepdef_hash['file_colon_line'] = stepdef.file_colon_line
      stepdef_hash['steps'] = steps.uniq.sort {|a,b| a['name'] <=> b['name']}
      stepdefs << stepdef_hash
    end
    if !File.directory?(@configuration.dotcucumber)
      FileUtils.mkdir_p(@configuration.dotcucumber)
    end
    File.open(File.join(@configuration.dotcucumber, 'stepdefs.json'), 'w') do |io|
      io.write(MultiJson.dump(stepdefs, :pretty => true))
    end
  end
end