Class: Cucumber::RbSupport::RegexpArgumentMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/rb_support/regexp_argument_matcher.rb

Class Method Summary collapse

Class Method Details

.arguments_from(regexp, step_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cucumber/rb_support/regexp_argument_matcher.rb', line 6

def self.arguments_from(regexp, step_name)
  match = regexp.match(step_name)
  if match
    n = 0
    match.captures.map do |val|
      n += 1
      start = match.offset(n)[0]
      StepArgument.new(val, start)
    end
  else
    nil
  end
end