Permalink
Browse files

Refactors backend additions

  • Loading branch information...
1 parent ac97c0a commit aa4109f404afca0d6f36bc6fa88d5c8c4121c438 @alindeman alindeman committed Mar 5, 2012
Showing with 5 additions and 5 deletions.
  1. +3 −3 lib/zonebie.rb
  2. +2 −2 lib/zonebie/backends/active_support.rb
View
@@ -13,7 +13,7 @@ def backend
def backend=(backend)
case backend
when Symbol
- @backend = @backends.detect { |b| b.name == backend }
+ @backend = @backends[backend]
else
@backend = backend
end
@@ -26,8 +26,8 @@ def backend=(backend)
end
def add_backend(backend)
- @backends ||= []
- @backends << backend
+ @backends ||= {}
+ @backends[backend.name] = backend
end
def set_random_timezone
@@ -3,8 +3,6 @@
module Zonebie
module Backends
class ActiveSupport
- Zonebie.add_backend(self)
-
class << self
def name
:activesupport
@@ -18,6 +16,8 @@ def zone=(zone)
::Time.zone = zone
end
end
+
+ Zonebie.add_backend(self)
end
end
end

0 comments on commit aa4109f

Please sign in to comment.