Module: Gorynich
- Defined in:
- lib/gorynich/head/delayed_job.rb,
lib/gorynich.rb,
lib/gorynich/head.rb,
lib/gorynich/config.rb,
lib/gorynich/engine.rb,
lib/gorynich/current.rb,
lib/gorynich/fetcher.rb,
lib/gorynich/version.rb,
lib/gorynich/switcher.rb,
lib/gorynich/configuration.rb,
lib/gorynich/fetchers/file.rb,
lib/gorynich/fetchers/consul.rb,
lib/gorynich/head/active_job.rb,
lib/gorynich/head/action_cable.rb,
lib/gorynich/head/active_record.rb,
lib/gorynich/head/rack_middleware.rb,
lib/gorynich/fetchers/consul_secure.rb,
lib/generators/gorynich/install_generator.rb,
lib/generators/gorynich/gorynich_generator.rb
Overview
:nocov:
Defined Under Namespace
Modules: Fetchers, Generators, Head Classes: Config, ConfigError, Configuration, Current, Engine, Error, Fetcher, HostNotFound, Switcher, TenantNotFound, UriNotFound
Constant Summary collapse
- VERSION =
'1.3.4'
Class Attribute Summary collapse
-
.configuration ⇒ Object
Configuration of gem.
Class Method Summary collapse
-
.configure {|configuration| ... } ⇒ Object
Setting up and initializing the gem.
-
.instance ⇒ Gorynich::Config
App configuration.
-
.reload ⇒ Object
Reload app configuration.
-
.reset ⇒ Object
Reset to default configuration settings.
-
.switcher ⇒ Gorynich::Switcher
Tenant switcher.
-
.with(*args, **opts, &block) ⇒ Object
Block for performing actions with a tenant database with a change in current attributes (ActiveSupport::CurrentAttributes).
-
.with_current(*args, &block) ⇒ Object
Block for performing actions with a tenant database with a change in current attributes (ActiveSupport::CurrentAttributes).
-
.with_database(*args, &block) ⇒ Object
Block for performing actions with a tenant database.
-
.with_each_tenant(**opts, &block) ⇒ Object
Block for performing actions with each tenant database.
Class Attribute Details
.configuration ⇒ Object
Configuration of gem
115 116 117 |
# File 'lib/gorynich.rb', line 115 def configuration @configuration end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
Setting up and initializing the gem
129 130 131 132 133 134 135 |
# File 'lib/gorynich.rb', line 129 def configure yield(configuration) reload ::ActiveRecord::Base.include(Head::ActiveRecord) end |
.instance ⇒ Gorynich::Config
App configuration
62 63 64 |
# File 'lib/gorynich.rb', line 62 def instance @instance ||= Config.new end |
.reload ⇒ Object
Reload app configuration
52 53 54 55 |
# File 'lib/gorynich.rb', line 52 def reload @instance = Config.new @switcher = Switcher.new(config: instance) end |
.reset ⇒ Object
Reset to default configuration settings
122 123 124 |
# File 'lib/gorynich.rb', line 122 def reset @configuration = Configuration.new end |
.switcher ⇒ Gorynich::Switcher
Tenant switcher
71 72 73 |
# File 'lib/gorynich.rb', line 71 def switcher @switcher ||= Switcher.new(config: instance) end |
.with(*args, **opts, &block) ⇒ Object
Block for performing actions with a tenant database with a change in current attributes (ActiveSupport::CurrentAttributes)
99 100 101 |
# File 'lib/gorynich.rb', line 99 def with(*args, **opts, &block) switcher.with(*args, **opts, &block) end |
.with_current(*args, &block) ⇒ Object
Block for performing actions with a tenant database with a change in current attributes (ActiveSupport::CurrentAttributes)
89 90 91 |
# File 'lib/gorynich.rb', line 89 def with_current(*args, &block) switcher.with_current(*args, &block) end |
.with_database(*args, &block) ⇒ Object
Block for performing actions with a tenant database
80 81 82 |
# File 'lib/gorynich.rb', line 80 def with_database(*args, &block) switcher.with_database(*args, &block) end |
.with_each_tenant(**opts, &block) ⇒ Object
Block for performing actions with each tenant database
108 109 110 |
# File 'lib/gorynich.rb', line 108 def with_each_tenant(**opts, &block) switcher.with_each_tenant(**opts, &block) end |