More versatile row value access. #118
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Added a method to allow the retrieval of a value in an AST Row by using the example table parameter that corresponds to it.
Details
Cucumber::Core::Ast::ExamplesTable::Row
now has a#[]
method.Motivation and Context
I wanted to be able to retrieve a value from a row without having to know ahead of time which position it would be in in the array returned by
#values
. I also didn't want to have to go through the effort of determining the index on the fly by accessing the header object, finding the index of the parameter name and then using that as the index for the value array. I just wanted a way to say "Hey, row! Give me the value that you used for this parameter!"How Has This Been Tested?
There's a spec for it.
There were a few failings specs but they were already failing and, given the very narrow nature of my change, are certainly not my fault.
Screenshots (if appropriate):
Types of changes
Checklist:
Added a method to allow retrieving a row value by it's corresponding parameter.