Sha256: 95da9d1c76f5337e8e9abae29e425369fee5315659a57bbe35abc73dba8531e0
Contents?: true
Size: 511 Bytes
Versions: 3
Compression:
Stored size: 511 Bytes
Contents
module Suricate class DelegationCallback def initialize(*callbacks) callbacks.each do |callback| define_callback(callback) end end def call(callback_name, *args) callback = instance_variable_get(:"@#{callback_name}_callback") callback.call(*args) if callback end private def define_callback(callback) define_singleton_method callback.to_sym do |&block| instance_variable_set(:"@#{callback}_callback", block) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
suricate-0.0.4 | lib/suricate/delegation_callback.rb |
suricate-0.0.3 | lib/suricate/delegation_callback.rb |
suricate-0.0.2 | lib/suricate/delegation_callback.rb |