Skip to content
Browse files

don't rely on ActiveSupport's core extensions

Use HashWithIndifferentAccess.new instead of {}.with_indifferent_access
  • Loading branch information...
1 parent a627fef commit 7b05e49e579ea9c54e3f62784f26877ab01465e0 James A. Rosen committed Mar 10, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/constellation.rb
View
12 lib/constellation.rb
@@ -12,6 +12,15 @@ def self.enhance(klass)
klass.send :include, Constellation::InstanceMethods
end
+ def self.hash_class
+ @hash_class ||= begin
+ require 'active_support/hash_with_indifferent_access'
+ ActiveSupport::HashWithIndifferentAccess
+ rescue LoadError
+ Hash
+ end
+ end
+
module ClassMethods
attr_accessor :env_params, :config_file, :load_from_gems
end
@@ -21,8 +30,7 @@ module InstanceMethods
include Enumerable
def initialize(data = nil)
- @data = {}
- indifferentize!
+ @data = Constellation.hash_class.new
reverse_merge(data || {})
fall_back_on_env
fall_back_on_file(Dir.pwd)

0 comments on commit 7b05e49

Please sign in to comment.
Something went wrong with that request. Please try again.