6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/aidp/core_ext/class_attribute.rb', line 6
def class_attribute(*attrs)
attrs.each do |name|
class_eval " @\#{name} = nil\n\n def self.\#{name}\n return @\#{name} if defined?(@\#{name})\n return superclass.\#{name} if superclass.respond_to?(:\#{name})\n nil\n end\n\n def self.\#{name}=(val)\n @\#{name} = val\n end\n\n def \#{name}\n self.class.\#{name}\n end\n\n def \#{name}=(val)\n raise \"\#{name} is a class attribute, cannot be set on instance\"\n end\n RUBY\n end\nend\n", __FILE__, __LINE__ + 1
|