class SpecProducer::Producers::Registry
Attributes
registrations[R]
Public Class Methods
new()
click to toggle source
# File lib/spec_producer/producers/registry.rb, line 9 def initialize @registrations = Set.new end
Public Instance Methods
each() { |registration| ... }
click to toggle source
# File lib/spec_producer/producers/registry.rb, line 17 def each return enum_for(:registrations) { registrations.size } unless block_given? registrations.each { |registration| yield(registration) } end
lookup!(symbol)
click to toggle source
# File lib/spec_producer/producers/registry.rb, line 31 def lookup!(symbol) registration = find_registration(symbol) if registration registration.call(symbol) else raise ArgumentError, "Unknown spec type #{symbol.inspect}" end end
register(spec_type, klass)
click to toggle source
# File lib/spec_producer/producers/registry.rb, line 13 def register(spec_type, klass) registrations << Registration.new(spec_type, klass) end
registered?(symbol)
click to toggle source
# File lib/spec_producer/producers/registry.rb, line 27 def registered?(symbol) !!find_registration(symbol) end
types()
click to toggle source
# File lib/spec_producer/producers/registry.rb, line 22 def types map(&:name) end
Also aliased as: registerd_types
Private Instance Methods
find_registration(symbol)
click to toggle source
# File lib/spec_producer/producers/registry.rb, line 42 def find_registration(symbol) registrations.find { |r| r.matches?(symbol) } end