about summary refs log tree commit
path: root/lib/metropolis/hash.rb
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2011-01-17 03:17:28 +0000
committerEric Wong <normalperson@yhbt.net>2011-01-17 09:18:31 +0000
commit2c913347a6e5cc8be776b14e1a177adec0fbd5b6 (patch)
tree8d001fa557ef23c66bc56aa6c2fba943e428382e /lib/metropolis/hash.rb
parent34a18520286313a05edc9a927ac4bed95b05191c (diff)
downloadmetropolis-2c913347a6e5cc8be776b14e1a177adec0fbd5b6.tar.gz
use constants everywhere to reduce GC thrashing
This makes it easier to notice a typo, too.
Diffstat (limited to 'lib/metropolis/hash.rb')
-rw-r--r--lib/metropolis/hash.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/metropolis/hash.rb b/lib/metropolis/hash.rb
index d5c70cb..75cc14e 100644
--- a/lib/metropolis/hash.rb
+++ b/lib/metropolis/hash.rb
@@ -37,16 +37,16 @@ module Metropolis::Hash
 
   def get(key, env)
     value = @db[key] or return r(404)
-    [ 200, { 'Content-Length' => value.size.to_s }.merge!(@headers), [ value ] ]
+    [ 200, { Content_Length => value.size.to_s }.merge!(@headers), [ value ] ]
   end
 
   def put(key, env)
-    value = env["rack.input"].read
-    case env['HTTP_X_TT_PDMODE']
-    when '1'
+    value = env[Rack_Input].read
+    case env[HTTP_X_TT_PDMODE]
+    when "1"
       @db.exists?(key) and r(409)
       @db[key] = value
-    when '2'
+    when "2"
       (tmp = @db[key] ||= "") << value
     else
       @db[key] = value