class Cucumber::StepMatch

:nodoc:
Represents the match found between a Test Step and its activation

def activate(test_step)

def activate(test_step)
  test_step.with_action(@step_definition.location) do
    invoke(MultilineArgument.from_core(test_step.multiline_arg))
  end
end

def args

def args
  current_world = @step_definition.registry.current_world
  @step_arguments.map do |arg|
    arg.value(current_world)
  end
end

def backtrace_line

def backtrace_line
  "#{file_colon_line}:in `#{@step_definition.expression}'"
end

def file_colon_line

def file_colon_line
  location.to_s
end

def format_args(format = ->(a) { a }, &proc)


lambda { |param| "[#{param}]" }

argument, for example:
If it is a Proc, it should take one argument and return the formatted

'%s'

Kernel#sprinf, for example:
If it is a String it should be a format string according to

The +format+ can either be a String or a Proc.

is usually called from visitors, which render output.
Formats the matched arguments of the associated Step. This method
def format_args(format = ->(a) { a }, &proc)
  replace_arguments(@name_to_match, @step_arguments, format, &proc)
end

def initialize(step_definition, step_name, step_arguments)

def initialize(step_definition, step_name, step_arguments)
  raise "step_arguments can't be nil (but it can be an empty array)" if step_arguments.nil?
  @step_definition = step_definition
  @name_to_match = step_name
  @step_arguments = step_arguments
end

def inspect # :nodoc:

:nodoc:
def inspect # :nodoc:
  "#<#{self.class}: #{location}>"
end

def invoke(multiline_arg)

def invoke(multiline_arg)
  all_args = args
  multiline_arg.append_to(all_args)
  @step_definition.invoke(all_args)
end

def location

def location
  @step_definition.location
end

def replace_arguments(string, step_arguments, format)

def replace_arguments(string, step_arguments, format)
  s = string.dup
  offset = past_offset = 0
  step_arguments.each do |step_argument|
    group = step_argument.group
    next if group.value.nil? || group.start < past_offset
    replacement = if block_given?
                    yield(group.value)
                  elsif format.instance_of?(Proc)
                    format.call(group.value)
                  else
                    format % group.value
                  end
    s[group.start + offset, group.value.length] = replacement
    offset += replacement.unpack('U*').length - group.value.unpack('U*').length
    past_offset = group.start + group.value.length
  end
  s
end

def text_length

def text_length
  @step_definition.expression.source.to_s.unpack('U*').length
end