Module: Datamappify::Repository::SingletonWrapper

Defined in:
lib/datamappify/repository.rb

Overview

Wraps a ruby Singleton class so that calling ‘instance` is no longer necessary.

Examples:

With ‘instance`

UserRepository.instance.count

Without ‘instance`

UserRepository.count

Class Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/datamappify/repository.rb', line 44

def self.extended(klass)
  class << klass
    extend Forwardable
    def_delegators :instance, :data_mapper, :data_mapper=, :states
    def_delegators :instance, *QueryMethods.instance_methods
  end
end