1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix for :instance_reader => false code example

This commit is contained in:
Andy Lindeman 2011-09-10 21:49:13 -04:00
parent 41d179b7d6
commit 28e32598b9

View file

@ -1020,7 +1020,7 @@ class A
class_attribute :x, :instance_reader => false
end
A.x = 1 # NoMethodError
A.new.x = 1 # NoMethodError
</ruby>
For convenience +class_attribute+ also defines an instance predicate which is the double negation of what the instance reader returns. In the examples above it would be called +x?+.