summaryrefslogtreecommitdiff
path: root/lib/metropolis/tc.rb
blob: 1f15e7b3033143a3c90ee2d416022a4d8747424c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# -*- encoding: binary -*-
require 'tokyocabinet'

module Metropolis::TC
  autoload :HDB, 'metropolis/tc/hdb'

  def self.extended(obj)
    obj.instance_eval do
      case ext = File.extname(@path_pattern || @path)
      when '.tch'
        extend Metropolis::TC::HDB
      else
        raise ArgumentError, "unsupported suffix: #{ext}"
      end
    end
  end
end