Class: ActiveRecord::Sharding::SequencerConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/sharding/sequencer_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameObject (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

#nameObject (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_nameObject (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