Sha256: 7536b03859374b2a5b9c8935da4abb1686e2fe395c4a919a7ab20c886a33a519
Contents?: true
Size: 883 Bytes
Versions: 1
Compression:
Stored size: 883 Bytes
Contents
require "forwardable" require "method_callbacks/definer" require "method_callbacks/executor" require "method_callbacks/locker" module MethodCallbacks class Method extend Forwardable attr_reader :name def_delegators :definer, :define, :define_with_block def_delegators :locker, :lock!, :locked?, :unlock! def initialize(name) @name = name end def ==(other) self.name == other.name end def callbacks(type) @_callbacks ||= {} @_callbacks[type] ||= [] end def execute(type, object) block_given? ? executor(type, object).execute(&Proc.new) : executor(type, object).execute end private def executor(type, object) Executor.new(self, type, object) end def definer @_definer ||= Definer.new(self) end def locker @_method_lock ||= Locker.new end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
method_callbacks-1.0.0 | lib/method_callbacks/method.rb |