Class: ActiveShard::ActiveRecord::ConnectionHandler::PoolKey

Inherits:
Object
  • Object
show all
Defined in:
lib/active_shard/active_record/connection_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema, shard) ⇒ PoolKey

Returns a new instance of PoolKey.



126
127
128
129
# File 'lib/active_shard/active_record/connection_handler.rb', line 126

def initialize( schema, shard )
  @schema = schema.nil? ? nil : schema.to_sym
  @shard  = shard.nil? ? nil : shard.to_sym
end

Instance Attribute Details

#schemaObject (readonly)

Returns the value of attribute schema.



124
125
126
# File 'lib/active_shard/active_record/connection_handler.rb', line 124

def schema
  @schema
end

#shardObject (readonly)

Returns the value of attribute shard.



124
125
126
# File 'lib/active_shard/active_record/connection_handler.rb', line 124

def shard
  @shard
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


135
136
137
138
# File 'lib/active_shard/active_record/connection_handler.rb', line 135

def eql?(other)
  (self.schema == other.schema &&
    self.shard  == other.shard)
end

#hashObject



131
132
133
# File 'lib/active_shard/active_record/connection_handler.rb', line 131

def hash
  [self.schema, self.shard].hash
end