Perl 6 is supposed to have native support for something like that. Constructor takes multiple patterns. The object matches if they all match.
Usage:
case foo when all(:foo, {:color => 'blue'}, /Hello/) print foo end
Methods
Public Class methods
[ show source ]
# File magic_xml.rb, line 1348 def initialize(*patterns) @patterns = patterns end
Public Instance methods
[ show source ]
# File magic_xml.rb, line 1351 def ===(obj) @patterns.all?{|p| p === obj} end