class FFWD::Plugin::GoogleCloud::SingleProxy

Attributes

error[R]

Public Class Methods

new(p) click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 289
def initialize p
  @callbacks = []
  @errbacks = []

  p.callback do
    call
  end

  p.errback do |error|
    err error
  end
end

Public Instance Methods

call() click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 310
def call
  @callbacks.each(&:call).clear
end
callback(&block) click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 302
def callback &block
  @callbacks << block
end
err(error) click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 314
def err error
  return if @errbacks.empty?

  @error = error

  @errbacks.each do |cb|
    cb.call error
  end.clear
end
errback(&block) click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 306
def errback &block
  @errbacks << block
end