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
commitdae0bfcf376fa0fb32fdde10587a8fb255cf1d00 (patch)
treec32d9ab64c2dee4abafdbd71ddb8eb4206aff9f3
parente022b74520978ad11e4db30aece8403099199e94 (diff)
change pattern matching [druby-ja:98]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@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 680b0ba..3562ff8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Apr 13 23:00:55 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 21:50:57 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bcc32/Makefile.sub (PHONY): Borland make disallows empty command
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})