Method: Saml::Notification::ClassMethods#wrap_with_notification

Defined in:
lib/saml/notification.rb

#wrap_with_notification(method, instance_method) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/saml/notification.rb', line 10

def wrap_with_notification(method, instance_method)
  wrapper = <<-RUBY
    define_method "#{method}_with_notification" do |*args|
      notify "#{method}", send("#{method}_without_notification", *args)
    end
    alias_method_chain :#{method}, :notification
  RUBY

  if instance_method
    class_eval wrapper
  else
    class_eval "class << self; #{wrapper}; end"
  end
end