diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object')
3 files changed, 8 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/blank.rb b/activesupport/lib/active_support/core_ext/object/blank.rb index eb99bb1a36..51670b148f 100644 --- a/activesupport/lib/active_support/core_ext/object/blank.rb +++ b/activesupport/lib/active_support/core_ext/object/blank.rb @@ -17,7 +17,7 @@ class Object def present? !blank? end - + # Returns object if it's #present? otherwise returns nil. # object.presence is equivalent to object.present? ? object : nil. # diff --git a/activesupport/lib/active_support/core_ext/object/instance_variables.rb b/activesupport/lib/active_support/core_ext/object/instance_variables.rb index 866317b17a..97b288c608 100644 --- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb +++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb @@ -7,7 +7,7 @@ class Object # @x, @y = x, y # end # end - # + # # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1} def instance_values #:nodoc: instance_variables.inject({}) do |values, name| @@ -24,7 +24,7 @@ class Object # @x, @y = x, y # end # end - # + # # C.new(0, 1).instance_variable_names # => ["@y", "@x"] if RUBY_VERSION >= '1.9' def instance_variable_names @@ -47,15 +47,15 @@ class Object # def initialize(x, y, z) # @x, @y, @z = x, y, z # end - # + # # def protected_instance_variables # %w(@z) # end # end - # + # # a = C.new(0, 1, 2) # b = C.new(3, 4, 5) - # + # # a.copy_instance_variables_from(b, [:@y]) # # a is now: @x = 3, @y = 1, @z = 2 def copy_instance_variables_from(object, exclude = []) #:nodoc: diff --git a/activesupport/lib/active_support/core_ext/object/returning.rb b/activesupport/lib/active_support/core_ext/object/returning.rb index 07250b2a27..c401992ccc 100644 --- a/activesupport/lib/active_support/core_ext/object/returning.rb +++ b/activesupport/lib/active_support/core_ext/object/returning.rb @@ -25,7 +25,7 @@ class Object # end # # foo # => ['bar', 'baz'] - # + # # # returning with a block argument # def foo # returning [] do |values| @@ -33,7 +33,7 @@ class Object # values << 'baz' # end # end - # + # # foo # => ['bar', 'baz'] def returning(value) ActiveSupport::Deprecation.warn('Object#returning has been deprecated in favor of Object#tap.', caller) |