From 420ffb79e317aeb555d38390baf70df32a9b71a2 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 1 Mar 2006 03:53:54 +0000 Subject: Added Kernel#daemonize to turn the current process into a daemon that can be killed with a TERM signal [DHH] Refactored stuff lingering in kernel.rb to the appropriate places git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3714 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_support/core_ext/object/misc.rb | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/object/misc.rb') diff --git a/activesupport/lib/active_support/core_ext/object/misc.rb b/activesupport/lib/active_support/core_ext/object/misc.rb index f599eee6f0..52c3773eea 100644 --- a/activesupport/lib/active_support/core_ext/object/misc.rb +++ b/activesupport/lib/active_support/core_ext/object/misc.rb @@ -1,4 +1,20 @@ class Object #:nodoc: + # A Ruby-ized realization of the K combinator, courtesy of Mikael Brockman. + # + # def foo + # returning values = [] do + # values << 'bar' + # values << 'baz' + # end + # end + # + # foo # => ['bar', 'baz'] + # + def returning(value) + yield + value + end + def with_options(options) yield ActiveSupport::OptionMerger.new(self, options) end @@ -6,11 +22,4 @@ class Object #:nodoc: def to_json ActiveSupport::JSON.encode(self) end - - def suppress(*exception_classes) - begin yield - rescue Exception => e - raise unless exception_classes.any? { |cls| e.kind_of?(cls) } - end - end end \ No newline at end of file -- cgit v1.2.3