Parent

Files

Class/Module Index [+]

Quicksearch

Cucumber::JsSupport::JsLanguage

Public Class Methods

new(runtime) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 108
def initialize(runtime)
  @step_definitions = []
  @world = JsWorld.new
  @runtime = runtime

  @world["jsLanguage"] = self
  @world.load(File.dirname(__FILE__) + '/js_dsl.js')
end

Public Instance Methods

add_step_definition(regexp, js_function) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 147
def add_step_definition(regexp, js_function)
  @step_definitions << JsStepDefinition.new(self, regexp, js_function)
end
alias_adverbs(adverbs) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 127
def alias_adverbs(adverbs)
end
begin_scenario(scenario) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 130
def begin_scenario(scenario)
  @language = scenario.language
end
current_world() click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 164
def current_world
  @world
end
end_scenario() click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 134
def end_scenario
end
execute_step_definition(name, multiline_argument = nil) click to toggle source

TODO: support multiline arguments when calling steps from within steps

# File lib/cucumber/js_support/js_language.rb, line 152
def execute_step_definition(name, multiline_argument = nil)
  @runtime.step_match(name).invoke(multiline_argument)
end
load_code_file(js_file) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 117
def load_code_file(js_file)
  @world.load(js_file)
end
register_js_hook(phase, tag_expressions, js_function) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 156
def register_js_hook(phase, tag_expressions, js_function)
  add_hook(phase, JsHook.new(self, tag_expressions, js_function))
end
register_js_transform(regexp, js_function) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 160
def register_js_transform(regexp, js_function)
  add_transform(JsTransform.new(self, regexp, js_function))
end
step_matches(name_to_match, name_to_format) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 137
def step_matches(name_to_match, name_to_format)
  @step_definitions.map do |step_definition|
    if(arguments = step_definition.arguments_from(name_to_match))
      StepMatch.new(step_definition, name_to_match, name_to_format, arguments)
    else
      nil
    end
  end.compact
end
steps(steps_text, file_colon_line) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 168
def steps(steps_text, file_colon_line)
  @runtime.invoke_steps(steps_text, @language, file_colon_line)
end
world(js_files) click to toggle source
# File lib/cucumber/js_support/js_language.rb, line 121
def world(js_files)
  js_files.each do |js_file|
    load_code_file("#{path_to_load_js_from}#{js_file}")
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.