Module: TT::BooleanAttributes
- Included in:
- Profiler
- Defined in:
- TT_Lib2/boolean_attributes.rb
Overview
Instance Method Summary collapse
- #battr(symbol, writable = false) ⇒ Object
- #battr_accessor(*args) ⇒ Object
- #battr_reader(*args) ⇒ Object
Instance Method Details
#battr(symbol, writable = false) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'TT_Lib2/boolean_attributes.rb', line 20 def battr( symbol, writable = false ) self.class_eval { attr( symbol, writable ) question = "#{symbol}?".to_sym alias_method( question, symbol ) remove_method( symbol ) } end |
#battr_accessor(*args) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'TT_Lib2/boolean_attributes.rb', line 30 def battr_accessor( *args ) self.class_eval { attr_accessor( *args ) for attribute in args question = "#{attribute}?".to_sym alias_method( question, attribute ) remove_method( attribute ) end } end |
#battr_reader(*args) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'TT_Lib2/boolean_attributes.rb', line 42 def battr_reader( *args ) self.class_eval { attr_reader( *args ) for attribute in args question = "#{attribute}?".to_sym alias_method( question, attribute ) remove_method( attribute ) end } end |