Class: ActiveRecord::Turntable::Configuration::DSL
- Inherits:
-
Object
- Object
- ActiveRecord::Turntable::Configuration::DSL
- Defined in:
- lib/active_record/turntable/configuration/dsl.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ClusterDSL
Constant Summary collapse
- GLOBAL_SETTINGS_KEYS =
%w( raise_on_not_specified_shard_query raise_on_not_specified_shard_update ).freeze
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
- #cluster(name, &block) ⇒ Object
- #global_settings_keys ⇒ Object
-
#initialize(configuration = Configuration.new) ⇒ DSL
constructor
A new instance of DSL.
Constructor Details
#initialize(configuration = Configuration.new) ⇒ DSL
Returns a new instance of DSL.
8 9 10 |
# File 'lib/active_record/turntable/configuration/dsl.rb', line 8 def initialize(configuration = Configuration.new) @configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
6 7 8 |
# File 'lib/active_record/turntable/configuration/dsl.rb', line 6 def configuration @configuration end |
Instance Method Details
#cluster(name, &block) ⇒ Object
12 13 14 15 |
# File 'lib/active_record/turntable/configuration/dsl.rb', line 12 def cluster(name, &block) cluster_dsl = ClusterDSL.new(configuration).tap { |dsl| dsl.instance_exec(&block) } configuration.clusters[name] = cluster_dsl.cluster end |
#global_settings_keys ⇒ Object
28 29 30 |
# File 'lib/active_record/turntable/configuration/dsl.rb', line 28 def global_settings_keys GLOBAL_SETTINGS_KEYS end |