#!/usr/bin/ruby

# blocks can be used to implement transaction semantics
# the following example uses a block-charged method to implement something akin to a cpp RAII

def procfile(path)
  f = File.open(path)
  yield f
  f.close()
end

procfile(__FILE__) do |file|
  for line in file
    puts line
  end
end

