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

Adding a block to do operations and close the connection in the end #209

Open
fabioperrella opened this issue Sep 25, 2019 · 0 comments
Open

Comments

@fabioperrella
Copy link

fabioperrella commented Sep 25, 2019

Hi!

First, great job with this gem, it helped us a lot!

After the merge of #175 , it is possible to use the shutdown method to close the connections, but what about having a method where it is possible to pass a block which will close the connection after yield it?

Example:

client.closing_connection do
  client.logical.read('something')
  client.login.write('something')
end

The implementation would be like this:

def closing_connection
  yield
ensure
  shutdown
end

The code is not 100% correct, it is just to show the ideia.

If you agree, I can send a pull request with this.

Thank you!

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

No branches or pull requests

1 participant