diff options
-rw-r--r-- | lib/bacon.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb index 48b76b2..dfc45e2 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -165,6 +165,7 @@ module Bacon def raise?(*args, &block); block.raise?(*args); end def throw?(*args, &block); block.throw?(*args); end + def change?(*args, &block); block.change?(*args); end end end @@ -206,6 +207,13 @@ class Proc } return true end + + def change? + pre_result = yield + called = call + post_result = yield + pre_result != post_result + end end class Numeric |