Sha256: 0f761b6ad2baba17d794759b49393e7ab94979da7e096acb0f69b08281f91984

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true

module God
  def self.registry
    @registry ||= Registry.new
  end

  class Registry
    def initialize
      @storage = {}
    end

    def add(item)
      # raise TypeError unless item.is_a? God::Process
      @storage[item.name] = item
    end

    def remove(item)
      @storage.delete(item.name)
    end

    def size
      @storage.size
    end

    def [](name)
      @storage[name]
    end

    def reset
      @storage.clear
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resurrected_god-1.1.1 lib/god/registry.rb
resurrected_god-1.1.0 lib/god/registry.rb