class Switchman::DefaultShard

Public Class Methods

_load(_str) click to toggle source
# File lib/switchman/default_shard.rb, line 66
def self._load(_str)
  Shard.default
end
instance() click to toggle source
# File lib/switchman/default_shard.rb, line 77
def instance
  @instance ||= new
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/switchman/default_shard.rb, line 70
def ==(other)
  return true if other.is_a?(DefaultShard) || (other.is_a?(Shard) && other[:default])

  super
end
_dump(_depth) click to toggle source
# File lib/switchman/default_shard.rb, line 62
def _dump(_depth)
  ''
end
activate(*_classes) { || ... } click to toggle source
# File lib/switchman/default_shard.rb, line 11
def activate(*_classes)
  yield
end
activate!(*classes) click to toggle source
# File lib/switchman/default_shard.rb, line 15
def activate!(*classes); end
cache_key()
Alias for: id
database_server() click to toggle source
# File lib/switchman/default_shard.rb, line 37
def database_server
  DatabaseServer.find(nil)
end
database_server_id() click to toggle source
# File lib/switchman/default_shard.rb, line 33
def database_server_id
  nil
end
default?() click to toggle source
# File lib/switchman/default_shard.rb, line 17
def default?
  true
end
description() click to toggle source
# File lib/switchman/default_shard.rb, line 53
def description
  ::Rails.env
end
global_id_for(local_id) click to toggle source
# File lib/switchman/default_shard.rb, line 29
def global_id_for(local_id)
  local_id
end
id() click to toggle source
# File lib/switchman/default_shard.rb, line 7
def id
  'default'
end
Also aliased as: cache_key
name() click to toggle source
# File lib/switchman/default_shard.rb, line 45
def name
  unless instance_variable_defined?(:@name)
    @name = nil # prevent taking this branch on recursion
    @name = database_server.shard_name(:bootstrap)
  end
  @name
end
new_record?() click to toggle source
# File lib/switchman/default_shard.rb, line 41
def new_record?
  false
end
primary?() click to toggle source
# File lib/switchman/default_shard.rb, line 21
def primary?
  true
end
relative_id_for(local_id, _target = nil) click to toggle source
# File lib/switchman/default_shard.rb, line 25
def relative_id_for(local_id, _target = nil)
  local_id
end
shard() click to toggle source

The default's shard is always the default shard

# File lib/switchman/default_shard.rb, line 58
def shard
  self
end