Module: CallMeRuby::ClassMethods

Defined in:
lib/call_me_ruby.rb

Overview

Common methods inherited by all classes

Instance Method Summary collapse

Instance Method Details

#class_callbacksObject



21
22
23
# File 'lib/call_me_ruby.rb', line 21

def class_callbacks
  @class_callbacks ||= Hash.new { |h, k| h[k] = [] }
end

#subscribe(name, *methods, &block) ⇒ Object



25
26
27
28
# File 'lib/call_me_ruby.rb', line 25

def subscribe(name, *methods, &block)
  methods.each { |method| class_callbacks[name] << method }
  class_callbacks[name] << block if block_given?
end