Flowdock
method

cattr_reader

Importance_2
v3.0.9 - Show latest stable - 2 notes - Class: Class
cattr_reader(*syms) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
January 27, 2009 - (v2.1.0 - v2.2.1)
2 thanks

Description

Similar to Ruby’s built-in attr_reader, only it creates a class attribute reader method (as opposed to an instance attribute reader method).

February 2, 2013
0 thanks

Other Example

##

class Exam
 cattr_reader :code, :description, :points, :instance_reader => false

 @@code = "EXM"
 @@description = "Sent Exam"
 @@points = 1000
end

In this case it’s possible to use

Exam.code # => EXM
Exam.description # => Sent Exam
Exam.points # => 1000