Module: Cangaroo::ClassConfiguration::ClassMethods
- Defined in:
- lib/cangaroo/class_configuration.rb
Overview
NOTE you must use the ‘_key` class attribute to nil out a class_cofiguration
Instance Method Summary collapse
Instance Method Details
#class_configuration(key, default = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cangaroo/class_configuration.rb', line 8 def class_configuration(key, default = nil) class_attribute :"_#{key}" define_singleton_method(key) do |*args| if args.empty? value = send(:"_#{key}") return value.nil? ? default : value end send(:"_#{key}=", args.first) end define_method(key) do self.class.send(key) end end |