Class: Viiite::BDB

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/viiite/bdb.rb,
lib/viiite/bdb/utils.rb,
lib/viiite/bdb/cached.rb,
lib/viiite/bdb/immediate.rb

Defined Under Namespace

Modules: Utils Classes: Cached, Immediate

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :folder       => "benchmarks",
  :cache        => true,
  :cache_mode   => "w",
  :pattern      => "**/*.rb",
}

Class Method Summary collapse

Methods included from Utils

#bench_file, #replace_extension

Class Method Details

.new(options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/viiite/bdb.rb', line 16

def self.new(options = {})
  options = DEFAULT_OPTIONS.merge(options)
  folder = options[:folder]
  bdb = BDB::Immediate.new(folder, options[:pattern])
  if cache = options[:cache]
    cache = File.join(folder, '.cache') unless cache.is_a?(String)
    bdb = BDB::Cached.new(bdb, cache, options[:cache_mode])
  end
  bdb
end