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

Remove Enumerable include from Statement class #1104

Merged
merged 1 commit into from
Feb 5, 2020

Conversation

adamcrown
Copy link
Contributor

I'm honestly not sure why this was here in the first place. Git blame seems to suggest that maybe it was added when the class was first created in anticipation for something that never materialized or has since been deprecated.

As far as I can tell, Enumerable offers no advantages to the class since Statement doesn't implement #each.

Here's an example of what I'm referring to

client = Mysql2::Client.new
statement = client.prepare('select 1')

statement.respond_to? :first
#=> true
statement.first
#=> NoMethodError: undefined method `each' for #<Mysql2::Statement:0x000055f59aa8b2c8>

statement.respond_to? :any?
#=> true
statement.any?
#=> NoMethodError: undefined method `each' for #<Mysql2::Statement:0x000055f59aa8b2c8>

statement.respond_to? :min
#=> true
statement.min
#=> NoMethodError: undefined method `each' for #<Mysql2::Statement:0x000055f59aa8b2c8>

Also all test pass with Enumerable gone, so it seems reasonable to remove it.

I'm honestly not sure why this was here in the first place. Git blame
seems to suggest that maybe it was added when the class was first
created in anticipation for something that never materialized or has
since been deprecated.

As far as I can tell, `Enumerable` offers no advantages to the class
since `Statement` doesn't implement `#each`.

Here's an example of what I'm referring to
```ruby
client = Mysql2::Client.new
statement = client.prepare('select 1')
statement.first
statement.any?
statement.min
```

Also all test pass with `Enumerable` gone, so it seems reasonable to
remove it.
@sodabrew sodabrew merged commit 982dbdb into brianmario:master Feb 5, 2020
@sodabrew
Copy link
Collaborator

sodabrew commented Feb 5, 2020

Must have been copied in accidentally from the Result class when the original work was done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants