Sha256: 2e99f8e3685ae6b32f8a6d842c7b08e91984f163ccd63892679f4a476f920e51

Contents?: true

Size: 526 Bytes

Versions: 5

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true
module Cucumber
  # Defines the location and value of a captured argument from the step
  # text
  class StepArgument
    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
      end
    end

    attr_reader :offset, :val

    def initialize(offset, val)
      @offset, @val = offset, val
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber-3.1.0 lib/cucumber/step_argument.rb
cucumber-3.0.2 lib/cucumber/step_argument.rb
cucumber-3.0.1 lib/cucumber/step_argument.rb
cucumber-3.0.0 lib/cucumber/step_argument.rb
cucumber-3.0.0.pre.2 lib/cucumber/step_argument.rb