Sha256: cf606bfce4c631cf28d6b04fac842b3e7863949325d6c1f9870fcc8945c263b1

Contents?: true

Size: 499 Bytes

Versions: 26

Compression:

Stored size: 499 Bytes

Contents

# frozen_string_literal: true

module Marameters
  # Builds a method's parameter signature.
  class Signature
    def initialize parameters, builder: Builder.new
      @parameters = parameters
      @builder = builder
    end

    def to_s = build.join ", "

    alias to_str to_s

    private

    attr_reader :parameters, :builder

    def build
      parameters.reduce [] do |signature, (kind, (name, default))|
        signature << builder.call(kind, name, default:)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
marameters-3.12.0 lib/marameters/signature.rb
marameters-3.11.0 lib/marameters/signature.rb
marameters-3.10.0 lib/marameters/signature.rb
marameters-3.9.0 lib/marameters/signature.rb
marameters-3.8.0 lib/marameters/signature.rb
marameters-3.7.0 lib/marameters/signature.rb
marameters-3.6.0 lib/marameters/signature.rb
marameters-3.5.0 lib/marameters/signature.rb
marameters-3.4.1 lib/marameters/signature.rb
marameters-3.3.0 lib/marameters/signature.rb
marameters-3.2.0 lib/marameters/signature.rb
marameters-3.1.0 lib/marameters/signature.rb
marameters-3.0.0 lib/marameters/signature.rb
marameters-2.1.1 lib/marameters/signature.rb
marameters-2.1.0 lib/marameters/signature.rb
marameters-2.0.1 lib/marameters/signature.rb
marameters-2.0.0 lib/marameters/signature.rb
marameters-1.0.4 lib/marameters/signature.rb
marameters-1.0.3 lib/marameters/signature.rb
marameters-1.0.2 lib/marameters/signature.rb