Class: Cucumber::JsSupport::JsStepDefinition
- Defined in:
- lib/cucumber/js_support/js_language.rb
Instance Method Summary collapse
- #arguments_from(step_name) ⇒ Object
- #file_colon_line ⇒ Object
-
#initialize(js_language, regexp, js_function) ⇒ JsStepDefinition
constructor
A new instance of JsStepDefinition.
- #invoke(args) ⇒ Object
- #regexp_source ⇒ Object
Constructor Details
#initialize(js_language, regexp, js_function) ⇒ JsStepDefinition
Returns a new instance of JsStepDefinition.
33 34 35 |
# File 'lib/cucumber/js_support/js_language.rb', line 33 def initialize(js_language, regexp, js_function) @js_language, @regexp, @js_function = js_language, regexp.to_s, js_function end |
Instance Method Details
#arguments_from(step_name) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/cucumber/js_support/js_language.rb', line 46 def arguments_from(step_name) matches = eval_js "#{@regexp}.exec('#{step_name}')" if matches matches.to_a[1..-1].map do |match| JsArg.new(match) end end end |
#file_colon_line ⇒ Object
55 56 57 58 |
# File 'lib/cucumber/js_support/js_language.rb', line 55 def file_colon_line # Not possible yet to get file/line of js function with V8/therubyracer "" end |
#invoke(args) ⇒ Object
37 38 39 40 |
# File 'lib/cucumber/js_support/js_language.rb', line 37 def invoke(args) args = @js_language.execute_transforms(args) @js_language.current_world.execute(@js_function, args) end |
#regexp_source ⇒ Object
42 43 44 |
# File 'lib/cucumber/js_support/js_language.rb', line 42 def regexp_source @regexp.inspect end |