Sha256: 798ce3e8b78b599bd667e8f22f78fb685bf3ac86b6c063d3b094a6e25c2c17e8

Contents?: true

Size: 541 Bytes

Versions: 3

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true

module Marameters
  module Signatures
    # Builds single argument for super method's signature when argument forwarding.
    Forwarder = lambda do |kind, name = nil|
      case kind
        when :req, :opt then name
        when :rest then "*#{name}"
        when :nokey then ""
        when :keyreq, :key then "#{name}:"
        when :keyrest then "**#{name}"
        when :block then "&#{name}"
        else fail ArgumentError, "Unable to forward unknown kind: #{kind.inspect}."
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marameters-4.1.0 lib/marameters/signatures/forwarder.rb
marameters-4.0.1 lib/marameters/signatures/forwarder.rb
marameters-4.0.0 lib/marameters/signatures/forwarder.rb