Class: Cucumber::StepArgument
- Inherits:
-
Object
- Object
- Cucumber::StepArgument
- Defined in:
- lib/cucumber/step_argument.rb
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.
20 21 22 |
# File 'lib/cucumber/step_argument.rb', line 20 def initialize(offset, val) @offset, @val = offset, val end |
Instance Attribute Details
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
18 19 20 |
# File 'lib/cucumber/step_argument.rb', line 18 def offset @offset end |
#val ⇒ Object (readonly)
Returns the value of attribute val.
18 19 20 |
# File 'lib/cucumber/step_argument.rb', line 18 def val @val end |
Class Method Details
.arguments_from(regexp, step_name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cucumber/step_argument.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 offset = match.offset(n)[0] new(offset, val) end end end |