[groonga-commit:3483] ranguba/hroonga [master] define default values as methods
null+ranguba at clear-code.com
null+ranguba at clear-code.com
Fri Jun 17 21:57:57 EDT 2011
SHIMODA Hiroshi 2011-06-18 01:57:57 +0000 (Sat, 18 Jun 2011)
New Revision: 6a0861e7723f466fdd57b816abaccf61d99febd7
Merged e63ed30: Merge branch 'master' of https://github.com/ranguba/hroonga into select-command
Log:
define default values as methods
Modified files:
lib/hroonga/command/request.rb
Modified: lib/hroonga/command/request.rb (+20 -9)
===================================================================
--- lib/hroonga/command/request.rb 2011-06-18 01:51:38 +0000 (b7f086d)
+++ lib/hroonga/command/request.rb 2011-06-18 01:57:57 +0000 (1f91ca2)
@@ -20,11 +20,6 @@ require "groonga"
module Hroonga
module Command
class Request < Rack::Request
- DEFAULT_TABLE_TYPE = :hash
- DEFAULT_KEY_TYPE = :ShortText
- DEFAULT_COLUMN_TYPE = :scalar
- DEFAULT_VALUE_TYPE = :ShortText
-
def method
(query["_method"] || env["REQUEST_METHOD"]).upcase
end
@@ -52,19 +47,35 @@ module Hroonga
def table_type
- @table_type ||= snake_cased_option("table_type") || DEFAULT_TABLE_TYPE
+ @table_type ||= snake_cased_option("table_type") || default_table_type
+ end
+
+ def default_table_type
+ :hash
end
def key_type
- @key_type ||= option("key_type") || DEFAULT_KEY_TYPE
+ @key_type ||= option("key_type") || default_key_type
+ end
+
+ def default_key_type
+ :ShortText
end
def column_type
- @column_type ||= snake_cased_option("column_type") || DEFAULT_COLUMN_TYPE
+ @column_type ||= snake_cased_option("column_type") || default_column_type
+ end
+
+ def default_column_type
+ :scalar
end
def value_type
- @value_type ||= option("value_type") || DEFAULT_VALUE_TYPE
+ @value_type ||= option("value_type") || default_value_type
+ end
+
+ def default_value_type
+ :ShortText
end
More information about the groonga-commit
mailing list