Class: Class
- Inherits:
-
Object
- Object
- Class
- Defined in:
- lib/action_web_service/support/class_inheritable_options.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#class_inheritable_option(sym, default_value = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/action_web_service/support/class_inheritable_options.rb', line 3 def class_inheritable_option(sym, default_value=nil) class_attribute "#{sym}_attr" self.send("#{sym}_attr=", default_value) if default_value class_eval <<-EOS def self.#{sym}(value=nil) if !value.nil? self.#{sym}_attr = value else self.#{sym}_attr end end def self.#{sym}=(value) self.#{sym}_attr = value end def #{sym} self.class.#{sym}_attr end def #{sym}=(value) self.class.#{sym}_attr = value end EOS end |