Skip to content
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

Fix Converters::CSV.each_host_rows yielded value #13

Merged
merged 2 commits into from
Apr 28, 2024

Conversation

AI-Mozi
Copy link
Member

@AI-Mozi AI-Mozi commented Apr 27, 2024

yield('foo', 'bar', 'baz') will yield 'foo'
yield(['foo', 'bar', 'baz']) will yield [foo', 'bar', 'baz']

@AI-Mozi AI-Mozi self-assigned this Apr 27, 2024
@AI-Mozi AI-Mozi added the bug Something isn't working label Apr 27, 2024
@AI-Mozi AI-Mozi requested a review from postmodern April 27, 2024 16:38
Copy link
Member

@postmodern postmodern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor additional changes needed.

@@ -102,7 +102,7 @@ def self.each_host_rows(host)
]

host.each_port do |port|
yield(*host_row, *port_to_row(port))
yield([*host_row, *port_to_row(port)])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably simplify this to just host_row + port_to_row(port).

@@ -102,7 +102,7 @@ def self.each_host_rows(host)
]

host.each_port do |port|
yield(*host_row, *port_to_row(port))
yield([*host_row, *port_to_row(port)])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're yielding an Array instead of multiple arguments, we should also change the above code on line 78 which receives splatted arguments:

each_host_rows(host) do |*row|

To

each_host_rows(host) do |row|

@postmodern postmodern merged commit 5ca241d into main Apr 28, 2024
14 checks passed
@postmodern postmodern deleted the fix_csv_each_host_rows_yield branch April 29, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants