Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Class Attribute setter returns set value

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
commit b9281e8e2c8a9955d551c0ec6720e9e342443c4b 1 parent 5f5c508
@wagenet wagenet authored wycats committed
View
1  activesupport/lib/active_support/core_ext/class/attribute.rb
@@ -72,6 +72,7 @@ def self.#{name}=(val)
remove_possible_method(:#{name})
define_method(:#{name}) { val }
end
+ val
end
def #{name}
View
5 activesupport/test/core_ext/class/attribute_test.rb
@@ -65,4 +65,9 @@ def setup
object.singleton_class.setting = 'foo'
assert_equal 'foo', object.setting
end
+
+ test 'setter returns set value' do
+ val = @klass.send(:setting=, 1)
+ assert_equal 1, val
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.