Class: FFWD::Plugin::GoogleCloud::CallbackProxy
- Inherits:
-
Object
- Object
- FFWD::Plugin::GoogleCloud::CallbackProxy
- Defined in:
- lib/ffwd/plugin/google_cloud/hook.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #call ⇒ Object
- #callback(&block) ⇒ Object
- #err(error) ⇒ Object
- #errback(&block) ⇒ Object
-
#initialize ⇒ CallbackProxy
constructor
A new instance of CallbackProxy.
- #into(other) ⇒ Object
Constructor Details
#initialize ⇒ CallbackProxy
Returns a new instance of CallbackProxy.
299 300 301 302 |
# File 'lib/ffwd/plugin/google_cloud/hook.rb', line 299 def initialize @callbacks = [] @errbacks = [] end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
297 298 299 |
# File 'lib/ffwd/plugin/google_cloud/hook.rb', line 297 def error @error end |
Instance Method Details
#call ⇒ Object
312 313 314 |
# File 'lib/ffwd/plugin/google_cloud/hook.rb', line 312 def call @callbacks.each(&:call).clear end |
#callback(&block) ⇒ Object
304 305 306 |
# File 'lib/ffwd/plugin/google_cloud/hook.rb', line 304 def callback &block @callbacks << block end |
#err(error) ⇒ Object
316 317 318 319 320 321 322 323 324 |
# File 'lib/ffwd/plugin/google_cloud/hook.rb', line 316 def err error return if @errbacks.empty? @error = error @errbacks.each do |cb| cb.call error end.clear end |
#errback(&block) ⇒ Object
308 309 310 |
# File 'lib/ffwd/plugin/google_cloud/hook.rb', line 308 def errback &block @errbacks << block end |
#into(other) ⇒ Object
326 327 328 329 |
# File 'lib/ffwd/plugin/google_cloud/hook.rb', line 326 def into other errback { other.err error } callback { other.call } end |