Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/rage/common.rb
Instance Method Summary collapse
-
#class_attr(*sym) ⇒ Object
Helper method to define class attributes.
Instance Method Details
#class_attr(*sym) ⇒ Object
Helper method to define class attributes
44 45 46 47 48 49 50 |
# File 'lib/rage/common.rb', line 44 def class_attr(*sym) syms = [sym].flatten # can pass either a single value or array to this method syms.each { |sym| module_eval "def self.#{sym}() @@#{sym} end" module_eval "def self.#{sym}=(x) @@#{sym}=x end" } end |