Module: ODDB::Util::Job

Defined in:
lib/oddb/util/job.rb

Class Method Summary collapse

Class Method Details

.run(opts = {}, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/oddb/util/job.rb', line 11

def Job.run opts={}, &block
  system = DRb::DRbObject.new(nil, ODDB.config.server_url)
  DRb.start_service
  begin
    system.peer_cache ODBA.cache unless opts[:readonly]
    block.call
  ensure
    system.unpeer_cache ODBA.cache unless opts[:readonly]
  end
end