Sha256: 8a03e72c0dde3ac196e7d28bbc202ff24cc4480667e97b3097cd52f90fc0830e

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 KB

Contents

require_dependency 'switchman/database_server'

module Switchman
  class DefaultShard
    def id; 'default'; end
    def activate(*categories); yield; end
    def activate!(*categories); end
    def default?; true; end
    def relative_id_for(local_id, target = nil); local_id; end
    def global_id_for(local_id); local_id; end
    def database_server_id; nil; end
    def database_server; DatabaseServer.find(nil); end
    def name
      unless instance_variable_defined?(:@name)
        @name = nil # prevent taking this branch on recursion
        @name = database_server.shard_name(:bootstrap)
      end
      @name
    end
    def description; ::Rails.env; end
    # The default's shard is always the default shard
    def shard; self; end
    def _dump(depth)
      ''
    end
    def self._load(str)
      Shard.default
    end

    def ==(rhs)
      return true if rhs.is_a?(Shard) && rhs.default?
      super
    end

    class << self
      def instance
        @instance ||= new
      end

      private :new
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
switchman-1.2.9 lib/switchman/default_shard.rb
switchman-1.2.8 lib/switchman/default_shard.rb
switchman-1.2.7 lib/switchman/default_shard.rb
switchman-1.2.5 lib/switchman/default_shard.rb
switchman-1.2.4 lib/switchman/default_shard.rb
switchman-1.2.3 lib/switchman/default_shard.rb
switchman-1.2.2 lib/switchman/default_shard.rb
switchman-1.2.1 lib/switchman/default_shard.rb
switchman-1.2.0 lib/switchman/default_shard.rb
switchman-1.1.0 lib/switchman/default_shard.rb
switchman-1.0.0 lib/switchman/default_shard.rb