Parent

Methods

Class Index [+]

Quicksearch

Cucumber::RbSupport::RbTransform

A Ruby Transform holds a Regexp and a Proc, and is created by calling Transform in the <tt>support ruby files. See also RbDsl.

Example:

  Transform /^(\d+) cucumbers$/ do |cucumbers_string|
    cucumbers_string.to_i
  end

Public Class Methods

new(rb_language, pattern, proc) click to toggle source
    # File lib/cucumber/rb_support/rb_transform.rb, line 20
20:       def initialize(rb_language, pattern, proc)
21:         raise MissingProc if proc.nil? || proc.arity < 1
22:         @rb_language, @regexp, @proc = rb_language, Regexp.new(pattern), proc
23:       end

Public Instance Methods

invoke(arg) click to toggle source
    # File lib/cucumber/rb_support/rb_transform.rb, line 29
29:       def invoke(arg)
30:         if matched = match(arg)
31:           args = matched.captures.empty? ? [arg] : matched.captures
32:           @rb_language.current_world.cucumber_instance_exec(true, @regexp.inspect, *args, &@proc)
33:         end
34:       end
match(arg) click to toggle source
    # File lib/cucumber/rb_support/rb_transform.rb, line 25
25:       def match(arg)
26:         arg ? arg.match(@regexp) : nil
27:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.