lib/parlour/rbs_generator/method_signature.rb
# Generates the RBS string for this signature.
#
# @param options [Options] The formatting options to use.
# @return [Array<String>] The RBS string, formatted as specified.
Generates the RBS string for this signature.
Generates the RBS string for this signature .
def generate_rbs(options)
        block_type = @block&.generate_rbs(options)
        rbs_params = parameters.reject { |x| x.kind == :block }.map(&:to_rbs_param)
        rbs_return_type = String === @return_type ? @return_type : @return_type&.generate_rbs
        generated_params = parameters.length >= options.break_params \
          ? ["("] +
            (
              parameters.empty? ? [] : rbs_params.map.with_index do |x, i|
                options.indented(
                  1,
                  parameters.length == i + 1 ? "#{x}" : "#{x},"
                )
              end
            ) +
            [")"]
          : ["(#{rbs_params.join(', ')})"]
        generated_params[0] = "#{
          type_parameters.any? ? "[#{type_parameters.join(', ')}] " : '' 
        }" + T.must(generated_params[0])
        generated_params[-1] = T.must(generated_params[-1]) + "#{
          (block_type && block_type.first != 'untyped') ? " #{block_type.first}" : '' 
        } -> #{rbs_return_type || 'void'}"
        generated_params
      end
def generate_rbs ( options ) block_type = @block &. generate_rbs ( options ) rbs_params = parameters . reject { | x | x . kind == :block } . map ( & :to_rbs_param ) rbs_return_type = String === @return_type ? @return_type : @return_type &. generate_rbs generated_params = parameters . length >= options . break_params ? [ "(" ] + ( parameters . empty? ? [ ] : rbs_params . map . with_index do | x , i | options . indented ( 1 , parameters . length == i + 1 ? "#{x}" : "#{x}," ) end ) + [ ")" ] : [ "(#{rbs_params.join(', ')})" ] generated_params [ 0 ] = "#{
          type_parameters.any? ? "[#{type_parameters.join(', ')}] " : '' 
        }" + T . must ( generated_params [ 0 ] ) generated_params [ - 1 ] = T . must ( generated_params [ - 1 ] ) + "#{
          (block_type && block_type.first != 'untyped') ? " #{block_type.first}" : '' # TODO: doesn't support multi-line block types
        } -> #{rbs_return_type || 'void'}" generated_params end
Generates the RBS string for this signature.
Generates the RBS string for this signature .
# Don't include the comma on the last parameter. # TODO: doesn't support multi-line block types
The RBS string, formatted as specified.
The RBS string formatted as specified .
Array<String>
options
The formatting options to use.
The formatting options to use .