Module: ActiveSupport::Delegation
- Defined in:
- lib/inquisitor/extensions.rb
Overview
:nodoc:
Class Method Summary collapse
Class Method Details
.perform(object, target, method, method_name, allow_nil, to, args, block) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/inquisitor/extensions.rb', line 43 def self.perform(object, target, method, method_name, allow_nil, to, args, block) target.__send__(method, *args, &block) rescue NoMethodError if target.nil? return nil if allow_nil raise "#{object.class}##{method_name} delegated to #{to}.#{method}, but #{to} is nil: #{object.inspect}" else raise end end |