summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-13 14:06:50 +0000
committerseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-13 14:06:50 +0000
commit44f586505fe1147e31b034b4559c17a0c3e2dea3 (patch)
tree5a9c6c7fc8d0892164fc8c5bceaaaf2d7e93c800
parentd938ed887563cb8b3c6be532d16a58d82dda9570 (diff)
change pattern matching [druby-ja:98]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/rinda/rinda.rb4
-rw-r--r--test/rinda/test_rinda.rb3
3 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index dc8d8fd..8eee61b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Apr 13 23:06:30 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/rinda.rb: change pattern matching.
+ a === b -> a == b || a === b. [druby-ja:98]
+
+ * test/rinda/test_rinda.rb: ditto.
+
Tue Apr 13 19:54:29 2004 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: should not overwrite HTTP request header.
diff --git a/lib/rinda/rinda.rb b/lib/rinda/rinda.rb
index a977d5c..37af342 100644
--- a/lib/rinda/rinda.rb
+++ b/lib/rinda/rinda.rb
@@ -105,7 +105,9 @@ module Rinda
return false
end
next if v.nil?
- return false unless (v === it)
+ next if v == it
+ next if v === it
+ return false
end
return true
end
diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb
index a87c662..684e44f 100644
--- a/test/rinda/test_rinda.rb
+++ b/test/rinda/test_rinda.rb
@@ -26,11 +26,12 @@ module TupleSpaceTestModule
assert(tmpl.match(['Rinda', 2, :hello]))
assert(!tmpl.match(['Rinda', 2, Symbol]))
assert(!tmpl.match([1, 2, :hello]))
+ assert(tmpl.match([/^rinda/i, nil, :hello]))
tmpl = Rinda::Template.new([Symbol])
assert_equal(1, tmpl.size)
assert(tmpl.match([:hello]))
- assert(!tmpl.match([Symbol]))
+ assert(tmpl.match([Symbol]))
assert(!tmpl.match(['Symbol']))
tmpl = Rinda::Template.new({"message"=>String, "name"=>String})