about summary refs log tree commit
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-23 12:09:56 -0800
committerEric Wong <normalperson@yhbt.net>2010-11-23 12:09:56 -0800
commitdf91c57c312bee97a16bced1035bd704e518ac38 (patch)
tree0678c58830c09e9a8e0de92a33fa078f2445ee4e /lib
parent51d43461adca99482154ddbd337658a70d5ffc3d (diff)
downloadmetropolis-df91c57c312bee97a16bced1035bd704e518ac38.tar.gz
rename internal "TokyoCabinet" => "TC"
It's less typing and less likely to clash on both
the eyes and the interpreter.
Diffstat (limited to 'lib')
-rw-r--r--lib/metropolis.rb4
-rw-r--r--lib/metropolis/tc.rb6
-rw-r--r--lib/metropolis/tc/hdb.rb (renamed from lib/metropolis/tokyocabinet/hdb.rb)6
-rw-r--r--lib/metropolis/tc/hdb/ro.rb (renamed from lib/metropolis/tokyocabinet/hdb/ro.rb)4
-rw-r--r--lib/metropolis/tokyocabinet.rb6
5 files changed, 13 insertions, 13 deletions
diff --git a/lib/metropolis.rb b/lib/metropolis.rb
index 987040d..05dc071 100644
--- a/lib/metropolis.rb
+++ b/lib/metropolis.rb
@@ -3,7 +3,7 @@ require 'rack'
 require 'uri'
 
 module Metropolis
-  autoload :TokyoCabinet, 'metropolis/tokyocabinet'
+  autoload :TC, 'metropolis/tc'
 
   def self.new(opts = {})
     opts = opts.dup
@@ -15,7 +15,7 @@ module Metropolis
       opts[:query] = Rack::Utils.parse_query(uri.query) if uri.query
       case ext = File.extname(uri.path)
       when '.tch'
-        rv.extend Metropolis::TokyoCabinet::HDB
+        rv.extend Metropolis::TC::HDB
       else
         raise ArgumentError, "unsupported suffix: #{ext}"
       end
diff --git a/lib/metropolis/tc.rb b/lib/metropolis/tc.rb
new file mode 100644
index 0000000..84dfaff
--- /dev/null
+++ b/lib/metropolis/tc.rb
@@ -0,0 +1,6 @@
+# -*- encoding: binary -*-
+require 'tokyocabinet'
+
+module Metropolis::TC
+  autoload :HDB, 'metropolis/tc/hdb'
+end
diff --git a/lib/metropolis/tokyocabinet/hdb.rb b/lib/metropolis/tc/hdb.rb
index 513d215..ec387b4 100644
--- a/lib/metropolis/tokyocabinet/hdb.rb
+++ b/lib/metropolis/tc/hdb.rb
@@ -2,10 +2,10 @@
 
 # this module is NOT thread-safe, all performance is dependent on the
 # local machine so there is never anything that needs yielding to threads.
-module Metropolis::TokyoCabinet::HDB
-  autoload :RO, 'metropolis/tokyocabinet/hdb/ro'
+module Metropolis::TC::HDB
+  autoload :RO, 'metropolis/tc/hdb/ro'
 
-  TCHDB = ::TokyoCabinet::HDB # :nodoc
+  TCHDB = TokyoCabinet::HDB # :nodoc
   include Rack::Utils # unescape
 
   def r(code)
diff --git a/lib/metropolis/tokyocabinet/hdb/ro.rb b/lib/metropolis/tc/hdb/ro.rb
index 89b4dd6..f348ee4 100644
--- a/lib/metropolis/tokyocabinet/hdb/ro.rb
+++ b/lib/metropolis/tc/hdb/ro.rb
@@ -1,10 +1,10 @@
 # -*- encoding: binary -*-
 
-module Metropolis::TokyoCabinet::HDB::RO
+module Metropolis::TC::HDB::RO
   def self.extended(obj)
    obj.instance_eval do
       @wr_flags = nil
-      @rd_flags |= ::TokyoCabinet::HDB::ONOLCK
+      @rd_flags |= TokyoCabinet::HDB::ONOLCK
       @dbv.each { |(hdb, path)|
         hdb.open(path, @rd_flags) or ex!(:open, path)
       }
diff --git a/lib/metropolis/tokyocabinet.rb b/lib/metropolis/tokyocabinet.rb
deleted file mode 100644
index 86b8104..0000000
--- a/lib/metropolis/tokyocabinet.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- encoding: binary -*-
-require 'tokyocabinet'
-
-module Metropolis::TokyoCabinet
-  autoload :HDB, 'metropolis/tokyocabinet/hdb'
-end