Module: Collective::Utilities::StorageBase::Resolver
- Included in:
- Collective::Utilities::StorageBase
- Defined in:
- lib/collective/utilities/storage_base.rb
Instance Method Summary collapse
-
#resolve(storage, *args) ⇒ Object
resolution is as so: nil, :mock => :mock :redis => redis://127.0.0.1:6379/1 string => CLASS.new CLASS => CLASS.new PROC => yield (recursive) [ ARRAY ] => first, *args (recursive).
Instance Method Details
#resolve(storage, *args) ⇒ Object
resolution is as so: nil, :mock => :mock :redis => redis://127.0.0.1:6379/1 string => CLASS.new CLASS => CLASS.new PROC => yield (recursive)
- ARRAY
-
> first, *args (recursive)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/collective/utilities/storage_base.rb', line 13 def resolve( storage, *args ) storage ||= :mock case when storage.respond_to?(:call) resolve(storage.call(*args)) else case storage when :mock resolve( Collective::Mocks::Storage, *args ) when :redis resolve( Collective::Redis::Storage, *args ) when Class storage.new(*args) when String resolve( Collective.resolve_class(storage), *args ) when Array args = storage.dup + args storage = args.shift resolve( storage, *args ) else return storage end end end |