Sha256: ebe24c13c9e101d20938c2f978971eca803969349c2689c46ec0b91c302c6bec

Contents?: true

Size: 561 Bytes

Versions: 4

Compression:

Stored size: 561 Bytes

Contents

module NxtPipeline
  class Constructor
    def initialize(name, **opts, &block)
      @name = name
      @block = block
      @opts = opts
    end

    attr_reader :opts, :block
    
    delegate :arity, to: :block
    
    def call(*args, **opts, &block)
      # ActiveSupport's #delegate does not properly handle keyword arg passing
      # in the latest released version. Thefore we bypass delegation by reimplementing
      # the method ourselves. This is already fixed in Rails master though.
      self.block.call(*args, **opts, &block)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nxt_pipeline-1.0.0 lib/nxt_pipeline/constructor.rb
nxt_pipeline-0.4.3 lib/nxt_pipeline/constructor.rb
nxt_pipeline-0.4.2 lib/nxt_pipeline/constructor.rb
nxt_pipeline-0.4.1 lib/nxt_pipeline/constructor.rb