Class: ActiveRecord::Sharding::SequencerConfig
- Inherits:
-
Object
- Object
- ActiveRecord::Sharding::SequencerConfig
- Defined in:
- lib/active_record/sharding/sequencer_config.rb
Instance Attribute Summary collapse
-
#connection_name ⇒ Object
readonly
Returns the value of attribute connection_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#initialize(name) ⇒ SequencerConfig
constructor
A new instance of SequencerConfig.
- #register_connection(connection_name) ⇒ Object
- #register_table_name(table_name) ⇒ Object
- #validate_config! ⇒ Object
Constructor Details
#initialize(name) ⇒ SequencerConfig
Returns a new instance of SequencerConfig.
6 7 8 9 10 |
# File 'lib/active_record/sharding/sequencer_config.rb', line 6 def initialize(name) @name = name @table_name = nil @connection_name = nil end |
Instance Attribute Details
#connection_name ⇒ Object (readonly)
Returns the value of attribute connection_name.
4 5 6 |
# File 'lib/active_record/sharding/sequencer_config.rb', line 4 def connection_name @connection_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/active_record/sharding/sequencer_config.rb', line 4 def name @name end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
4 5 6 |
# File 'lib/active_record/sharding/sequencer_config.rb', line 4 def table_name @table_name end |
Instance Method Details
#register_connection(connection_name) ⇒ Object
12 13 14 |
# File 'lib/active_record/sharding/sequencer_config.rb', line 12 def register_connection(connection_name) @connection_name = connection_name end |
#register_table_name(table_name) ⇒ Object
16 17 18 |
# File 'lib/active_record/sharding/sequencer_config.rb', line 16 def register_table_name(table_name) @table_name = table_name end |
#validate_config! ⇒ Object
20 21 22 23 |
# File 'lib/active_record/sharding/sequencer_config.rb', line 20 def validate_config! raise "Nothing connection. Please call register_connection" if @connection_name.blank? raise "Nothing table_name. Please call register_table_name" if @table_name.blank? end |