• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂21 (tree)
時間2007-10-11 22:39:52
作者junkikuchi

Log Message

* trunk/lib/tenarai/db/tree.rb
* trunk/test/test_db_tree.rb

changed class names Tree to SimpleTree and ArrayTree to Tree.

* trunk/lib/tenarai/service.rb

added @action.

Change Summary

差異

--- trunk/test/test_db_tree.rb (revision 20)
+++ trunk/test/test_db_tree.rb (revision 21)
@@ -7,11 +7,11 @@
77 require 'tenarai/db/tree'
88
99 class DBRowTreeTest < Test::Unit::TestCase
10- class Tree < Tenarai::DB::Row::Tree
10+ class Tree < Tenarai::DB::Row::SimpleTree
1111 column Tenarai::DB::String.new('name', :default => 'DEFAULT')
1212 end
1313
14- class ArrayTree < Tenarai::DB::Row::ArrayTree
14+ class ArrayTree < Tenarai::DB::Row::Tree
1515 column Tenarai::DB::String.new('name', :default => 'DEFAULT')
1616 end
1717
--- trunk/lib/tenarai/db/tree.rb (revision 20)
+++ trunk/lib/tenarai/db/tree.rb (revision 21)
@@ -7,7 +7,7 @@
77 module Tenarai
88 class DB
99 class Row
10- class Tree < Row
10+ class SimpleTree < Row
1111 column Reference.new('parent')
1212 column Reference.new('nodes', :multiple => true)
1313
@@ -20,23 +20,23 @@
2020 end
2121 end
2222
23- class ArrayTree < Row
23+ class Tree < Row
2424 class Multiple < Tenarai::DB::Reference::Multiple
2525 def _insert(nth, node)
2626 size = (node.max - node.min) + 1
2727 diff = nth - (node.min + size)
2828
29- ArrayTree.open_loop(@link.src_table, size, nth)
29+ Tree.open_loop(@link.src_table, size, nth)
3030 if 0 < diff
31- ArrayTree.open_loop(
31+ Tree.open_loop(
3232 @link.src_table, diff + size, node.min, node.max
3333 )
3434 else
35- ArrayTree.close_loop(
35+ Tree.close_loop(
3636 @link.src_table, diff.abs, node.min + size, node.max + size
3737 )
3838 end
39- ArrayTree.close_loop(@link.src_table, size, node.min + size)
39+ Tree.close_loop(@link.src_table, size, node.min + size)
4040
4141 @link.src_table.reload
4242 @link.link(@row, node)
--- trunk/lib/tenarai/service.rb (revision 20)
+++ trunk/lib/tenarai/service.rb (revision 21)
@@ -27,11 +27,11 @@
2727 _nil, action, *params = (request['path_info'] || '/').split('/')
2828 name, method = (action || @default).split('.')
2929
30- [name, request.method + '_' + method, params]
30+ [action.to_s, name, request.method + '_' + method, params]
3131 end
3232
3333 def dispatch(request, response)
34- name, method, params = parse_request(request)
34+ action, name, method, params = parse_request(request)
3535
3636 service = fetch_service(name)
3737
@@ -50,7 +50,7 @@
5050 service.container = self
5151 service.request = request
5252 service.response = response
53- service.dispatch(method, params)
53+ service.dispatch(method, action, params)
5454 end
5555
5656 def to_proc
Show on old repository browser