Permalink
Browse files

Removing self. from defs and just extending self.

  • Loading branch information...
1 parent 852506d commit 31adf0260c7ea241030741f5fa6230190b451e57 @jnunemaker committed Nov 8, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/adapter.rb
View
11 lib/adapter.rb
@@ -3,14 +3,15 @@
require 'adapter/exceptions'
module Adapter
+ extend self
extend Asserts
# Stores the definitions for each adapter by name
- def self.definitions
+ def definitions
@definitions ||= {}
end
- def self.define(name, mod=nil, &block)
+ def define(name, mod=nil, &block)
definition_module = Module.new
definition_module.send(:include, Defaults)
definition_module.send(:include, mod) unless mod.nil?
@@ -21,17 +22,17 @@ def self.define(name, mod=nil, &block)
end
# Memoizes adapter instances based on their definitions
- def self.adapters
+ def adapters
@adapters ||= {}
end
- def self.[](name)
+ def [](name)
assert_valid_adapter(name)
adapters[name.to_sym] ||= get_adapter_instance(name)
end
private
- def self.get_adapter_instance(name)
+ def get_adapter_instance(name)
Class.new do
attr_reader :client, :options

0 comments on commit 31adf02

Please sign in to comment.