-
-
Notifications
You must be signed in to change notification settings - Fork 50
V17/redundancy optimisation #318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
39fb746
3acc239
cf31a38
de6ef90
df0b9e1
8f0b332
ec399bc
8f53769
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'cucumber/core/test/location' | ||
| require 'cucumber/core/test/result' | ||
| require 'cucumber/core/test/timer' | ||
| require_relative 'location' | ||
| require_relative 'result' | ||
| require_relative 'timer' | ||
|
|
||
| require 'cucumber/core/test/action/defined' | ||
| require 'cucumber/core/test/action/undefined' | ||
| require 'cucumber/core/test/action/unskippable' | ||
| require_relative 'action/defined' | ||
| require_relative 'action/undefined' | ||
| require_relative 'action/unskippable' |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,60 +16,52 @@ module Test | |||||
| # | ||||||
| # And a matching StepDefinition: | ||||||
| # | ||||||
| # Given /I have:/ do |table| | ||||||
| # Given('I have:') do |table| | ||||||
| # data = table.raw | ||||||
| # end | ||||||
| # | ||||||
| # This will store <tt>[['a', 'b'], ['c', 'd']]</tt> in the <tt>data</tt> variable. | ||||||
| # | ||||||
| class DataTable | ||||||
| # Creates a new instance. +raw+ should be an Array of Array of String | ||||||
| # or an Array of Hash | ||||||
| attr_reader :raw | ||||||
|
|
||||||
| # Creates a new instance. +raw+ should be a square (2d), array of strings or an array of hashes | ||||||
| # | ||||||
| # You don't typically create your own DataTable objects - Cucumber will do | ||||||
| # it internally and pass them to your Step Definitions. | ||||||
| # | ||||||
| def initialize(rows) | ||||||
| raw = ensure_array_of_array(rows) | ||||||
|
Comment on lines
+28
to
33
|
||||||
| verify_rows_are_same_length(raw) | ||||||
| @raw = raw.freeze | ||||||
| end | ||||||
| attr_reader :raw | ||||||
|
|
||||||
| def describe_to(visitor, *) | ||||||
| visitor.data_table(self, *) | ||||||
| end | ||||||
|
|
||||||
| def to_step_definition_arg | ||||||
| dup | ||||||
| def ==(other) | ||||||
| other.class == self.class && raw == other.raw | ||||||
| end | ||||||
|
|
||||||
| def data_table? | ||||||
| true | ||||||
| end | ||||||
|
|
||||||
| def describe_to(visitor, *) | ||||||
| visitor.data_table(self, *) | ||||||
| end | ||||||
|
|
||||||
| def doc_string? | ||||||
| false | ||||||
| end | ||||||
|
|
||||||
| # Creates a copy of this table | ||||||
| # | ||||||
| def dup | ||||||
| self.class.new(raw.dup) | ||||||
| end | ||||||
|
|
||||||
| # Returns a new, transposed table. Example: | ||||||
| # | ||||||
| # | a | 7 | 4 | | ||||||
| # | b | 9 | 2 | | ||||||
| # | ||||||
| # Gets converted into the following: | ||||||
| # | ||||||
| # | a | b | | ||||||
| # | 7 | 9 | | ||||||
| # | 4 | 2 | | ||||||
| # | ||||||
| def transpose | ||||||
| self.class.new(raw.transpose) | ||||||
| def inspect | ||||||
| %{#<#{self.class} #{raw.inspect})>} | ||||||
|
||||||
| %{#<#{self.class} #{raw.inspect})>} | |
| %{#<#{self.class} #{raw.inspect}>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the signature to
language = 'en'subtly changes behavior when callers passnilexplicitly: it will now set@languagetonilinstead of defaulting to'en'. If the intention is to keep the previous behavior, coercenilto'en'(e.g.@language = language || 'en').