Sha256: 9a3614669fc523c010504c1e52824f529c0f279ee4a9b96f8df87c98f2ac4021

Contents?: true

Size: 455 Bytes

Versions: 4

Compression:

Stored size: 455 Bytes

Contents

module LintTrap
  # Allow registration and discovery of plugins
  class Registry
    def initialize
      @registry = {}
    end

    def default(thing_class)
      @registry.default = thing_class.new
    end

    def register(thing_class)
      thing = thing_class.new
      registry[thing.name] = thing
    end

    def find(name)
      registry[name]
    end

    def all
      registry.values
    end

  protected

    attr_reader :registry
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lint_trap-0.0.19 lib/lint_trap/registry.rb
lint_trap-0.0.18 lib/lint_trap/registry.rb
lint_trap-0.0.17 lib/lint_trap/registry.rb
lint_trap-0.0.16 lib/lint_trap/registry.rb