Module: BallGag::Disable::ClassMethods
- Included in:
- BallGag
- Defined in:
- lib/ball_gag/disable.rb
Instance Method Summary collapse
Instance Method Details
#disable! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ball_gag/disable.rb', line 16 def disable! old_enabled = @enabled @enabled = false if block_given? begin yield ensure @enabled = old_enabled end end end |
#enable! ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ball_gag/disable.rb', line 4 def enable! old_enabled = @enabled @enabled = true if block_given? begin yield ensure @enabled = old_enabled end end end |
#enabled? ⇒ Boolean
28 29 30 31 |
# File 'lib/ball_gag/disable.rb', line 28 def enabled? return @enabled if @enabled == false @enabled || true end |