mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
check remote hash tuple
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6de9ca7651
commit
898f094d8d
3 changed files with 20 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
Sun Oct 16 14:40:54 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||
|
||||
* lib/rinda/rinda.rb (Rinda::Tuple#initialize): check remote hash
|
||||
tuple. fixed: [ruby-list:41227]
|
||||
|
||||
* test/rinda/test_rinda.rb: test it.
|
||||
|
||||
Sun Oct 16 00:13:14 2005 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/configure.bat: remove unnecessary line which prevents
|
||||
|
|
|
@ -31,7 +31,7 @@ module Rinda
|
|||
class Tuple
|
||||
# Initialize a tuple with an Array or a Hash.
|
||||
def initialize(ary_or_hash)
|
||||
if Hash === ary_or_hash
|
||||
if hash?(ary_or_hash)
|
||||
init_with_hash(ary_or_hash)
|
||||
else
|
||||
init_with_ary(ary_or_hash)
|
||||
|
@ -68,6 +68,10 @@ module Rinda
|
|||
end
|
||||
|
||||
private
|
||||
def hash?(ary_or_hash)
|
||||
ary_or_hash.respond_to?(:keys)
|
||||
end
|
||||
|
||||
def init_with_ary(ary)
|
||||
@tuple = Array.new(ary.size)
|
||||
@tuple.size.times do |i|
|
||||
|
|
|
@ -510,6 +510,14 @@ class TupleSpaceProxyTest < Test::Unit::TestCase
|
|||
@ts = Rinda::TupleSpaceProxy.new(@ts_base)
|
||||
end
|
||||
|
||||
def test_remote_array_and_hash
|
||||
@ts.write(DRbObject.new([1, 2, 3]))
|
||||
assert_equal([1, 2, 3], @ts.take([1, 2, 3], 0))
|
||||
@ts.write(DRbObject.new({'head' => 1, 'tail' => 2}))
|
||||
assert_equal({'head' => 1, 'tail' => 2},
|
||||
@ts.take({'head' => 1, 'tail' => 2}, 0))
|
||||
end
|
||||
|
||||
@server = DRb.primary_server || DRb.start_service
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue