diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 8ba283122def99004e1cf5a46a42ebf6764dd502..0e4f1da7b20b840eb9a63a82bd9bdbd98e221489 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -48,6 +48,14 @@ The method +present?+ is equivalent to +!blank?+: assert @response.body.present? # same as !@response.body.blank? +h4. +presence+ + +The +presence+ method returns its receiver if +present?+, and +nil+ otherwise. It is useful for idioms like this: + + +host = config[:host].presence || 'localhost' + + h4. +duplicable?+ A few fundamental objects in Ruby are singletons. For example, in the whole live of a program the integer 1 refers always to the same instance: