class Rake::Funnel::Support::Patch

Public Class Methods

new(context = nil) { |self| ... } click to toggle source
# File lib/rake/funnel/support/patch.rb, line 7
def initialize(context = nil)
  @context = context

  yield self if block_given?
end

Public Instance Methods

apply!() click to toggle source
# File lib/rake/funnel/support/patch.rb, line 21
def apply!
  return self if @memo

  @memo = (@setup || noop).call(@context)

  self
end
reset(&block) click to toggle source
# File lib/rake/funnel/support/patch.rb, line 17
def reset(&block)
  @reset = block
end
revert!() click to toggle source
# File lib/rake/funnel/support/patch.rb, line 29
def revert!
  return self unless @memo

  (@reset || noop).call(@memo)
  @memo = nil

  self
end
setup(&block) click to toggle source
# File lib/rake/funnel/support/patch.rb, line 13
def setup(&block)
  @setup = block
end

Private Instance Methods

noop() click to toggle source
# File lib/rake/funnel/support/patch.rb, line 40
def noop
  proc {}
end