diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-01 03:53:54 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-01 03:53:54 +0000 |
commit | 420ffb79e317aeb555d38390baf70df32a9b71a2 (patch) | |
tree | f1d4164943c64351e54ca98a5e4e59a5f1743c7c /activesupport/lib/active_support/core_ext/object | |
parent | 8adaf10ecabf3c48b39042044fa58e9933b1f208 (diff) | |
download | rails-420ffb79e317aeb555d38390baf70df32a9b71a2.tar.gz rails-420ffb79e317aeb555d38390baf70df32a9b71a2.tar.bz2 rails-420ffb79e317aeb555d38390baf70df32a9b71a2.zip |
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
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/misc.rb | 23 |
1 files changed, 16 insertions, 7 deletions
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 |