lib/ae/assertor.rb in ae-1.1.0 vs lib/ae/assertor.rb in ae-1.2
- old
+ new
@@ -30,11 +30,11 @@
end
# Internal assert, provides all functionality accosicated
# with external #assert Object method.
#
- # NOTE: I'm calling YAGNI on the extra arguments to the block.
+ # NOTE: I'm calling YAGNI on any extra arguments to the block.
#
def assert(*args, &block)
return self if args.empty? && !block_given?
block = args.shift if !block_given? && Proc === args.first
if block
@@ -64,12 +64,19 @@
#
def flunk(msg=nil)
fail Assertion.new(msg || @message, :backtrace=>@backtrace)
end
+ # Ruby seems to have a quark in it's implementation whereby
+ # this must be defined explicitly, otherwise it somehow
+ # skips #method_missing.
+ def =~(match)
+ method_missing(:"=~", match)
+ end
+
private
- # Converts missing methods into an Assertion.
+ # Converts a missing methods into an Assertion.
#
def method_missing(sym, *a, &b)
pass = @delegate.__send__(sym, *a, &b)
#if (@negated ? pass : !pass)
unless @negated ^ pass