提交 5b10e475 编写于 作者: N Neeraj Singh

adding comment specifying that cattr_accessor also supports instance_write and...

adding comment specifying that cattr_accessor also supports instance_write and instance_rader option
上级 eb902d6c
......@@ -14,6 +14,16 @@
# Person.hair_colors = [:brown, :black, :blonde, :red]
# Person.hair_colors #=> [:brown, :black, :blonde, :red]
# Person.new.hair_colors #=> [:brown, :black, :blonde, :red]
#
# To opt out of the instance writer method, pass :instance_writer => false.
# To opt out of the instance reader method, pass :instance_reader => false.
#
# class Person
# cattr_accessor :hair_colors, :instance_writer => false, :instance_reader => false
# end
#
# Person.new.hair_colors = [:brown] # => NoMethodError
# Person.new.hair_colors # => NoMethodError
class Class
def cattr_reader(*syms)
options = syms.extract_options!
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册