class Cucumber::StepArgument

Defines the location and value of a captured argument from the step text

Attributes

offset[R]
val[R]

Public Class Methods

arguments_from(regexp, step_name) click to toggle source
# File lib/cucumber/step_argument.rb, line 5
def self.arguments_from(regexp, step_name)
  match = regexp.match(step_name)
  if match
    n = 0
    match.captures.map do |val|
      n += 1
      offset = match.offset(n)[0]
      new(offset, val)
    end
  else
    nil
  end
end
new(offset, val) click to toggle source
# File lib/cucumber/step_argument.rb, line 21
def initialize(offset, val)
  @offset, @val = offset, val
end