Skip to content

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

Description

@fabioperrella

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions