Module: WhoDelegated::ActiveRecordExtension

Defined in:
lib/who_delegated/active_record_extension.rb

Overview

Extend ActiveRecord::Base with delegated_method? method

Instance Method Summary collapse

Instance Method Details

#delegated_method?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/who_delegated/active_record_extension.rb', line 7

def delegated_method?(method_name)
  respond_to?("delegated_#{method_name}?") && send("delegated_#{method_name}?")
end

#delegated_target(method_name) ⇒ Object



11
12
13
14
15
# File 'lib/who_delegated/active_record_extension.rb', line 11

def delegated_target(method_name)
  return unless delegated_method?(method_name)

  send("delegated_#{method_name}?")
end