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

Version Path
bbk-app-1.1.1.273627 lib/bbk/app/factory.rb
bbk-app-1.1.1.273338 lib/bbk/app/factory.rb
bbk-app-1.1.1.273312 lib/bbk/app/factory.rb
bbk-app-1.1.1.273294 lib/bbk/app/factory.rb
bbk-app-1.1.0.219406 lib/bbk/app/factory.rb
bbk-app-1.1.0.216998 lib/bbk/app/factory.rb
bbk-app-1.1.0.204569 lib/bbk/app/factory.rb
bbk-app-1.1.0.200751 lib/bbk/app/factory.rb
bbk-app-1.1.0.200186 lib/bbk/app/factory.rb
bbk-app-1.1.0.199675 lib/bbk/app/factory.rb
bbk-app-1.1.0.199604 lib/bbk/app/factory.rb
bbk-app-1.1.0.199389 lib/bbk/app/factory.rb
bbk-app-1.1.0.199383 lib/bbk/app/factory.rb
bbk-app-1.0.0.152254 lib/bbk/app/factory.rb
bbk-app-1.0.0.141716 lib/bbk/app/factory.rb
bbk-app-1.0.0.80957 lib/bbk/app/factory.rb
bbk-app-1.0.0.79514 lib/bbk/app/factory.rb
bbk-app-1.0.0.79241 lib/bbk/app/factory.rb