Class: Moltrio::Config::MultitenantRedisAdapter
- Defined in:
- lib/moltrio/config/adapters/multitenant_redis_adapter.rb
Instance Attribute Summary collapse
-
#base_path ⇒ Object
readonly
Returns the value of attribute base_path.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #available_namespaces ⇒ Object
-
#initialize(config, base_path) ⇒ MultitenantRedisAdapter
constructor
A new instance of MultitenantRedisAdapter.
- #missing_namespace? ⇒ Boolean
- #on_namespace(namespace) ⇒ Object
Methods inherited from Adapter
#[], #[]=, #fetch, #fetch_all, #has_key?, #slice
Constructor Details
#initialize(config, base_path) ⇒ MultitenantRedisAdapter
Returns a new instance of MultitenantRedisAdapter.
6 7 8 9 |
# File 'lib/moltrio/config/adapters/multitenant_redis_adapter.rb', line 6 def initialize(config, base_path) @config = config @base_path = base_path end |
Instance Attribute Details
#base_path ⇒ Object (readonly)
Returns the value of attribute base_path.
19 20 21 |
# File 'lib/moltrio/config/adapters/multitenant_redis_adapter.rb', line 19 def base_path @base_path end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
19 20 21 |
# File 'lib/moltrio/config/adapters/multitenant_redis_adapter.rb', line 19 def config @config end |
Instance Method Details
#available_namespaces ⇒ Object
15 16 17 |
# File 'lib/moltrio/config/adapters/multitenant_redis_adapter.rb', line 15 def available_namespaces redis.smembers(base_path) end |
#missing_namespace? ⇒ Boolean
11 12 13 |
# File 'lib/moltrio/config/adapters/multitenant_redis_adapter.rb', line 11 def missing_namespace? true end |
#on_namespace(namespace) ⇒ Object
20 21 22 |
# File 'lib/moltrio/config/adapters/multitenant_redis_adapter.rb', line 20 def on_namespace(namespace) SingleRedisAdapter.new(config, [base_path, namespace].join(":")) end |