Class: RDL::Switch
Instance Method Summary collapse
-
#initialize ⇒ Switch
constructor
A new instance of Switch.
- #off ⇒ Object
- #off? ⇒ Boolean
Constructor Details
#initialize ⇒ Switch
Returns a new instance of Switch.
2 3 4 |
# File 'lib/rdl/switch.rb', line 2 def initialize @switch = true end |
Instance Method Details
#off ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rdl/switch.rb', line 8 def off() return unless @switch tmp = @switch @switch = false begin ret = yield ensure @switch = tmp end return ret end |
#off? ⇒ Boolean
5 6 7 |
# File 'lib/rdl/switch.rb', line 5 def off?() return not(@switch) end |