diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/class')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/attribute_accessors.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb index eee61d48c4..186ca69c05 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb @@ -1,6 +1,12 @@ # Extends the class object with class and instance accessors for class attributes, # just like the native attr* accessors for instance attributes. -class Class # :nodoc: +# +# class Person +# cattr_accessor :hair_colors +# end +# +# Person.hair_colors = [:brown, :black, :blonde, :red] +class Class def cattr_reader(*syms) syms.flatten.each do |sym| next if sym.is_a?(Hash) |