Sha256: 49a82d1bf948cdc836f524998459d857ec448efc8f0b7185dacecfe345d8da3e
Contents?: true
Size: 572 Bytes
Versions: 18
Compression:
Stored size: 572 Bytes
Contents
# frozen_string_literal: true module BBK module App class Factory attr_accessor :klass, :instanceargs, :instancekwargs def initialize(klass, *args, **kwargs) @klass = klass @instanceargs = args @instancekwargs = kwargs end def create if RUBY_VERSION < '2.7' && instancekwargs.empty? klass.new(*instanceargs) else klass.new(*instanceargs, **instancekwargs) end end def call(*args, **kwargs) create.call(*args, **kwargs) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems