Class: Rake::Funnel::Support::Patch
- Inherits:
-
Object
- Object
- Rake::Funnel::Support::Patch
- Defined in:
- lib/rake/funnel/support/patch.rb
Instance Method Summary collapse
- #apply! ⇒ Object
-
#initialize(context = nil) {|_self| ... } ⇒ Patch
constructor
A new instance of Patch.
- #reset(&block) ⇒ Object
- #revert! ⇒ Object
- #setup(&block) ⇒ Object
Constructor Details
#initialize(context = nil) {|_self| ... } ⇒ Patch
Returns a new instance of Patch.
5 6 7 8 9 |
# File 'lib/rake/funnel/support/patch.rb', line 5 def initialize(context = nil) @context = context yield self if block_given? end |
Instance Method Details
#apply! ⇒ Object
19 20 21 22 23 24 |
# File 'lib/rake/funnel/support/patch.rb', line 19 def apply! return self if @memo @memo = (@setup || noop).call(@context) self end |
#reset(&block) ⇒ Object
15 16 17 |
# File 'lib/rake/funnel/support/patch.rb', line 15 def reset(&block) @reset = block end |
#revert! ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/rake/funnel/support/patch.rb', line 26 def revert! return self unless @memo (@reset || noop).call(@memo) @memo = nil self end |
#setup(&block) ⇒ Object
11 12 13 |
# File 'lib/rake/funnel/support/patch.rb', line 11 def setup(&block) @setup = block end |