metropolis.git  about / heads / tags
key-value store for Rack
blob 1f15e7b3033143a3c90ee2d416022a4d8747424c 365 bytes (raw)
$ git show HEAD:lib/metropolis/tc.rb	# shows this blob on the CLI

 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

git clone https://yhbt.net/metropolis.git