Sha256: c2c553d1f9e0c48c7986786ce8d01871761267df8f43ee3e133e24e14a4f7752
Contents?: true
Size: 850 Bytes
Versions: 1
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true # This is the base class for the registrars. # It defines the interface that other registrars inherit. # This is an abstract class. # The child classes inheriting this interface must define the 'value' method. module DispatchRider module Registrars class Base attr_reader :store def initialize @store = {} end def register(name, options = {}) store[name.to_sym] = value(name, options) self rescue NameError raise NotFound, name end def value(name, options = {}) raise NotImplementedError end def unregister(name) store.delete(name.to_sym) self end def fetch(name) store.fetch(name.to_sym) rescue IndexError raise NotRegistered, name end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dispatch-rider-2.2.0 | lib/dispatch-rider/registrars/base.rb |