lib/trailblazer/context/indifferent_access.rb in trailblazer-context-0.1.3 vs lib/trailblazer/context/indifferent_access.rb in trailblazer-context-0.1.4
- old
+ new
@@ -1,23 +1,18 @@
module Trailblazer
class Context
class IndifferentAccess < Context
def [](name)
- super(name.to_sym)
+ # TODO: well...
+ @mutable_options.key?(name.to_sym) and return @mutable_options[name.to_sym]
+ @mutable_options.key?(name.to_s) and return @mutable_options[name.to_s]
+ @wrapped_options.key?(name.to_sym) and return @wrapped_options[name.to_sym]
+ @wrapped_options[name.to_s]
end
- def []=(name, value)
- super(name.to_sym, value)
- end
-
def key?(name)
- super(name.to_sym)
+ super(name.to_sym) || super(name.to_s)
end
- def merge(hash)
- hash = Hash[hash.collect { |k,v| [k.to_sym, v] }]
-
- super(hash)
- end
end
end
end