Skip to content

Commit

Permalink
fix attribute_accessors docs to support 1.8 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Rodriguez committed May 9, 2012
1 parent 5059c32 commit dd7e7b3
Showing 1 changed file with 11 additions and 11 deletions.
Expand Up @@ -21,11 +21,11 @@ class Class
# end
# # => NameError: invalid attribute name
#
# If you want to opt out the instance reader method, you can pass <tt>instance_reader: false</tt>
# or <tt>instance_accessor: false</tt>.
# If you want to opt out the instance reader method, you can pass <tt>:instance_reader => false</tt>
# or <tt>:instance_accessor => false</tt>.
#
# class Person
# cattr_reader :hair_colors, instance_reader: false
# cattr_reader :hair_colors, :instance_reader => false
# end
#
# Person.new.hair_colors # => NoMethodError
Expand Down Expand Up @@ -71,11 +71,11 @@ def #{sym}
# end
# # => NameError: invalid attribute name
#
# If you want to opt out the instance writer method, pass <tt>instance_writer: false</tt>
# or <tt>instance_accessor: false</tt>.
# If you want to opt out the instance writer method, pass <tt>:instance_writer => false</tt>
# or <tt>:instance_accessor => false</tt>.
#
# class Person
# cattr_writer :hair_colors, instance_writer: false
# cattr_writer :hair_colors, :instance_writer => false
# end
#
# Person.new.hair_colors = [:blonde, :red] # => NoMethodError
Expand Down Expand Up @@ -133,20 +133,20 @@ def #{sym}=(obj)
# Male.hair_colors << :blue
# Person.hair_colors # => [:brown, :black, :blonde, :red, :blue]
#
# To opt out of the instance writer method, pass <tt>instance_writer: false</tt>.
# To opt out of the instance reader method, pass <tt>instance_reader: false</tt>.
# To opt out of the instance writer method, pass <tt>:instance_writer => false</tt>.
# To opt out of the instance reader method, pass <tt>:instance_reader => false</tt>.
#
# class Person
# cattr_accessor :hair_colors, instance_writer: false, instance_reader: false
# cattr_accessor :hair_colors, :instance_writer => false, :instance_reader => false
# end
#
# Person.new.hair_colors = [:brown] # => NoMethodError
# Person.new.hair_colors # => NoMethodError
#
# Or pass <tt>instance_accessor: false</tt>, to opt out both instance methods.
# Or pass <tt>:instance_accessor => false</tt>, to opt out both instance methods.
#
# class Person
# cattr_accessor :hair_colors, instance_accessor: false
# cattr_accessor :hair_colors, :instance_accessor => false
# end
#
# Person.new.hair_colors = [:brown] # => NoMethodError
Expand Down

0 comments on commit dd7e7b3

Please sign in to comment.