Module: OklahomaMixer

Defined in:
lib/oklahoma_mixer.rb,
lib/oklahoma_mixer/error.rb,
lib/oklahoma_mixer/query.rb,
lib/oklahoma_mixer/cursor.rb,
lib/oklahoma_mixer/query/c.rb,
lib/oklahoma_mixer/cursor/c.rb,
lib/oklahoma_mixer/hash_map.rb,
lib/oklahoma_mixer/utilities.rb,
lib/oklahoma_mixer/array_list.rb,
lib/oklahoma_mixer/hash_map/c.rb,
lib/oklahoma_mixer/array_list/c.rb,
lib/oklahoma_mixer/hash_database.rb,
lib/oklahoma_mixer/table_database.rb,
lib/oklahoma_mixer/b_tree_database.rb,
lib/oklahoma_mixer/hash_database/c.rb,
lib/oklahoma_mixer/table_database/c.rb,
lib/oklahoma_mixer/b_tree_database/c.rb,
lib/oklahoma_mixer/extensible_string.rb,
lib/oklahoma_mixer/extensible_string/c.rb,
lib/oklahoma_mixer/fixed_length_database.rb,
lib/oklahoma_mixer/fixed_length_database/c.rb

Defined Under Namespace

Modules: Error, Utilities Classes: ArrayList, BTreeDatabase, Cursor, ExtensibleString, FixedLengthDatabase, HashDatabase, HashMap, Query, TableDatabase

Constant Summary collapse

VERSION =
"0.4.0"

Class Method Summary collapse

Class Method Details

.open(path, *args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/oklahoma_mixer.rb', line 9

def self.open(path, *args)
  db_class = case File.extname(path).downcase
             when ".tch" then HashDatabase
             when ".tcb" then BTreeDatabase
             when ".tcf" then FixedLengthDatabase
             when ".tct" then TableDatabase
             else             fail ArgumentError, "unsupported database type"
             end
  db       = db_class.new(path, *args)
  if block_given?
    begin
      yield db
    ensure
      db.close
    end
  else
    db
  end
end