Skip to content

Instantly share code, notes, and snippets.

@Ball
Created October 31, 2012 12:40
Show Gist options
  • Select an option

  • Save Ball/3986836 to your computer and use it in GitHub Desktop.

Select an option

Save Ball/3986836 to your computer and use it in GitHub Desktop.

Revisions

  1. Ball created this gist Oct 31, 2012.
    15 changes: 15 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    def using(object, message, *args)
    begin
    yield if block_given?
    ensure
    object.send(message, *args)
    end


    obj = SomthingToClose.connect

    records = []
    using(obj, :close) do
    records = obj.get_all_the_things
    process(records)
    end