Sha256: b304b26dfb5584e6834848e280d02cc78bedf1280e6901095460fa64f9b56092
Contents?: true
Size: 416 Bytes
Versions: 1
Compression:
Stored size: 416 Bytes
Contents
# frozen_string_literal: true module ConfigMapper module Factory def self.resolve(arg) return arg if arg.respond_to?(:new) return ProcFactory.new(arg) if arg.respond_to?(:call) raise ArgumentError, "invalid factory" end end class ProcFactory def initialize(f) # rubocop:disable Naming/MethodParameterName @f = f end def new @f.call end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
config_mapper-1.8.0 | lib/config_mapper/factory.rb |