Created
March 24, 2009 13:15
-
-
Save walf443/84076 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b3d76028378e5a0fa59b3bda042f189b57cb1539 Mon Sep 17 00:00:00 2001 | |
From: Keiji, Yoshimi <walf443@gmail.com> | |
Date: Sat, 21 Mar 2009 18:23:53 +0900 | |
Subject: [PATCH 1/3] added patch for support ruby 1.9.1 | |
--- | |
tokyotyrant.rb | 17 ++++++++++++++--- | |
1 files changed, 14 insertions(+), 3 deletions(-) | |
diff --git a/tokyotyrant.rb b/tokyotyrant.rb | |
index 4e7a70a..a2b719e 100644 | |
--- a/tokyotyrant.rb | |
+++ b/tokyotyrant.rb | |
@@ -1,3 +1,4 @@ | |
+# vim: set encoding: utf-8 | |
#-- | |
# Pure Ruby interface of Tokyo Cabinet | |
# Copyright (C) 2006-2008 Mikio Hirabayashi | |
@@ -949,9 +950,19 @@ module TokyoTyrant | |
private | |
# Get a string argument.%% | |
def _argstr(obj) | |
- return obj.to_s if obj.is_a?(Numeric) | |
- return obj if obj.is_a?(String) | |
- raise ArgumentError | |
+ str = case obj | |
+ when Numeric | |
+ obj.to_s | |
+ when String | |
+ obj | |
+ else | |
+ raise ArgumentError | |
+ end | |
+ | |
+ if str.respond_to? :force_encoding and !str.frozen? | |
+ str.force_encoding('ASCII-8BIT')- | |
+ end | |
+ str | |
end | |
# Get a numeric argument.%% | |
def _argnum(obj) | |
--- | |
1.6.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment