Class: Cucumber::StepArgument
Overview
Defines the location and value of a captured argument from the step text
Instance Attribute Summary collapse
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#val ⇒ Object
readonly
Returns the value of attribute val.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(offset, val) ⇒ StepArgument
constructor
A new instance of StepArgument.
Constructor Details
#initialize(offset, val) ⇒ StepArgument
Returns a new instance of StepArgument.
21 22 23 |
# File 'lib/cucumber/step_argument.rb', line 21 def initialize(offset, val) @offset, @val = offset, val end |
Instance Attribute Details
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
19 20 21 |
# File 'lib/cucumber/step_argument.rb', line 19 def offset @offset end |
#val ⇒ Object (readonly)
Returns the value of attribute val.
19 20 21 |
# File 'lib/cucumber/step_argument.rb', line 19 def val @val end |
Class Method Details
.arguments_from(regexp, step_name) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# 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 |