aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object')
-rw-r--r--activesupport/lib/active_support/core_ext/object/blank.rb7
-rw-r--r--activesupport/lib/active_support/core_ext/object/duplicable.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/object/with_options.rb1
3 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/blank.rb b/activesupport/lib/active_support/core_ext/object/blank.rb
index 09d9af1bde..e238fef5a2 100644
--- a/activesupport/lib/active_support/core_ext/object/blank.rb
+++ b/activesupport/lib/active_support/core_ext/object/blank.rb
@@ -43,6 +43,7 @@ class NilClass
# +nil+ is blank:
#
# nil.blank? # => true
+ #
def blank?
true
end
@@ -52,6 +53,7 @@ class FalseClass
# +false+ is blank:
#
# false.blank? # => true
+ #
def blank?
true
end
@@ -61,6 +63,7 @@ class TrueClass
# +true+ is not blank:
#
# true.blank? # => false
+ #
def blank?
false
end
@@ -71,6 +74,7 @@ class Array
#
# [].blank? # => true
# [1,2,3].blank? # => false
+ #
alias_method :blank?, :empty?
end
@@ -79,6 +83,7 @@ class Hash
#
# {}.blank? # => true
# {:key => 'value'}.blank? # => false
+ #
alias_method :blank?, :empty?
end
@@ -89,6 +94,7 @@ class String
# ' '.blank? # => true
# ' '.blank? # => true
# ' something here '.blank? # => false
+ #
def blank?
self !~ /[^[:space:]]/
end
@@ -99,6 +105,7 @@ class Numeric #:nodoc:
#
# 1.blank? # => false
# 0.blank? # => false
+ #
def blank?
false
end
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb
index 9cd7485e2e..f1b755c2c4 100644
--- a/activesupport/lib/active_support/core_ext/object/duplicable.rb
+++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb
@@ -31,6 +31,7 @@ class NilClass
#
# nil.duplicable? # => false
# nil.dup # => TypeError: can't dup NilClass
+ #
def duplicable?
false
end
@@ -41,6 +42,7 @@ class FalseClass
#
# false.duplicable? # => false
# false.dup # => TypeError: can't dup FalseClass
+ #
def duplicable?
false
end
@@ -51,6 +53,7 @@ class TrueClass
#
# true.duplicable? # => false
# true.dup # => TypeError: can't dup TrueClass
+ #
def duplicable?
false
end
@@ -61,6 +64,7 @@ class Symbol
#
# :my_symbol.duplicable? # => false
# :my_symbol.dup # => TypeError: can't dup Symbol
+ #
def duplicable?
false
end
@@ -71,6 +75,7 @@ class Numeric
#
# 3.duplicable? # => false
# 3.dup # => TypeError: can't dup Fixnum
+ #
def duplicable?
false
end
diff --git a/activesupport/lib/active_support/core_ext/object/with_options.rb b/activesupport/lib/active_support/core_ext/object/with_options.rb
index 723bf69189..e058367111 100644
--- a/activesupport/lib/active_support/core_ext/object/with_options.rb
+++ b/activesupport/lib/active_support/core_ext/object/with_options.rb
@@ -36,6 +36,7 @@ class Object
#
# <tt>with_options</tt> can also be nested since the call is forwarded to its receiver.
# Each nesting level will merge inherited defaults in addition to their own.
+ #
def with_options(options)
yield ActiveSupport::OptionMerger.new(self, options)
end