Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7032a50297
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (40 sloc) 0.844 kb
module Arel
class Session
class << self
attr_accessor :instance
alias_method :manufacture, :new
def start
if @started
yield
else
begin
@started = true
@instance = manufacture
metaclass.send :alias_method, :new, :instance
yield
ensure
metaclass.send :alias_method, :new, :manufacture
@started = false
end
end
end
end
module CRUD
def create(insert)
insert.call
end
def read(select)
(@read ||= Hash.new do |hash, select|
hash[select] = select.call
end)[select]
end
def update(update)
update.call
end
def delete(delete)
delete.call
end
end
include CRUD
end
end
Jump to Line
Something went wrong with that request. Please try again.