Sha256: 79c02b453845af58d367aed14c1c31460d022d55d7ccff492f3c703fd03fe3d4
Contents?: true
Size: 503 Bytes
Versions: 6
Compression:
Stored size: 503 Bytes
Contents
require "forwardable" module MethodCallbacks class Definer extend Forwardable attr_reader :method def_delegators :method, :callbacks, :name def initialize(method) @method = method end def define(type, callbacks) callbacks.each do |callback| callbacks(type) << callback if !callbacks(type).include?(callback) end end def define_with_block(type, &block) callbacks(type) << block if !callbacks(type).include?(block) end end end
Version data entries
6 entries across 6 versions & 1 rubygems