Module: Arspy::Delegators::Factory

Defined in:
lib/arspy/delegators/factory.rb

Class Method Summary collapse

Class Method Details

.module_for(klass) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/arspy/delegators/factory.rb', line 9

def self.module_for(klass)
  case klass.name
  when 'Array' then Arspy::Delegators::ArrayExtensions
  when 'ActiveRecord::Base' then Arspy::Delegators::ActiveRecordExtensions
  when 'ActiveRecord::Associations::HasManyThroughAssociation', 'ActiveRecord::Associations::AssociationCollection'
    then Arspy::Delegators::AssociationCollectionExtensions
  else
    Arspy::Delegators::NullExtensions
  end
end