• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂24 (tree)
時間2007-10-29 00:34:18
作者junkikuchi

Log Message

made changes for making url support.

Change Summary

差異

--- trunk/lib/tenarai/preference.rb (revision 23)
+++ trunk/lib/tenarai/preference.rb (revision 24)
@@ -6,6 +6,7 @@
66 require 'tenarai/container'
77 require 'tenarai/xml'
88 require 'tenarai/meta'
9+require 'tenarai/cgi/query'
910
1011 module Tenarai
1112 class Preference < HashTree
@@ -163,6 +164,14 @@
163164 super
164165 end
165166
167+ def to_query
168+ ret = Tenarai::CGI::Query.new
169+ traverse do |v|
170+ ret[v.path_name] = v.value
171+ end
172+ ret
173+ end
174+
166175 def deep_clone
167176 inject(self.class.new) do |ret, val|
168177 ret << val.deep_clone
--- trunk/lib/tenarai/db.rb (revision 23)
+++ trunk/lib/tenarai/db.rb (revision 24)
@@ -55,6 +55,8 @@
5555 handle.execute(stmt, *bindvar)
5656 end
5757
58+ alias :exec :execute
59+
5860 def query(stmt, *bindvar, &block)
5961 if @params[:echo]
6062 puts stmt
--- trunk/lib/tenarai/service.rb (revision 23)
+++ trunk/lib/tenarai/service.rb (revision 24)
@@ -10,8 +10,8 @@
1010 attr_accessor :request
1111 attr_accessor :response
1212
13- def dispatch(method, action, params)
14- __send__(method, *params)
13+ def dispatch(dispatch, method, params)
14+ __send__(dispatch, *params)
1515 end
1616
1717 module Dispatcher
@@ -27,7 +27,7 @@
2727 _nil, action, *params = (request['path_info'] || '/').split('/')
2828 name, method = (action || @default).split('.')
2929
30- [action.to_s, name, request.method + '_' + method, params]
30+ [name, method, params, request.method + '_' + method]
3131 end
3232
3333 def before_dispatch
@@ -36,7 +36,7 @@
3636 def dispatch(request, response)
3737 before_dispatch
3838
39- action, name, method, params = parse_request(request)
39+ name, method, params, dispatch = parse_request(request)
4040
4141 service = fetch_service(name)
4242
@@ -50,12 +50,12 @@
5050 "Could not found '%s' method on '%s' class." % [
5151 method, service.class.name
5252 ]
53- ) unless service.respond_to?(method)
53+ ) unless service.respond_to?(dispatch)
5454
5555 service.container = self
5656 service.request = request
5757 service.response = response
58- service.dispatch(method, action, params)
58+ service.dispatch(dispatch, method, params)
5959
6060 after_dispatch
6161 end
--- trunk/lib/tenarai/cgi/query.rb (revision 23)
+++ trunk/lib/tenarai/cgi/query.rb (revision 24)
@@ -77,6 +77,10 @@
7777 end.join(';')
7878 end
7979
80+ def empty?
81+ @query.empty?
82+ end
83+
8084 def each(&block)
8185 @query.each(&block)
8286 end
Show on old repository browser