class TypedOperation::Curried

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/typed_operation/curried.rbs

class TypedOperation::Curried
  def call: ((Integer | String) arg) -> (String | TypedOperation::Curried)
  def initialize: (Class operation_class, ?TypedOperation::PartiallyApplied? partial_operation) -> void
  def next_keyword_parameter: () -> Symbol
  def next_parameter_positional?: () -> false
end

def call(arg)

Experimental RBS support (using type sampling data from the type_fusion project).

def call: ((Integer | String) arg) -> (String | TypedOperation::Curried)

This signature was generated using 2 samples from 1 application.

def call(arg)
  raise ArgumentError, "A prepared operation should not be curried" if @partial_operation.prepared?
  next_partially_applied = if next_parameter_positional?
    @partial_operation.with(arg)
  else
    @partial_operation.with(next_keyword_parameter => arg)
  end
  if next_partially_applied.prepared?
    next_partially_applied.call
  else
    Curried.new(@operation_class, next_partially_applied)
  end
end

def initialize(operation_class, partial_operation = nil)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (Class operation_class, ?TypedOperation::PartiallyApplied? partial_operation) -> void

This signature was generated using 2 samples from 1 application.

def initialize(operation_class, partial_operation = nil)
  @operation_class = operation_class
  @partial_operation = partial_operation || operation_class.with
end

def next_keyword_parameter

Experimental RBS support (using type sampling data from the type_fusion project).

def next_keyword_parameter: () -> Symbol

This signature was generated using 1 sample from 1 application.

def next_keyword_parameter
  remaining = @operation_class.required_keyword_parameters - @partial_operation.keyword_args.keys
  remaining.first
end

def next_parameter_positional?

Experimental RBS support (using type sampling data from the type_fusion project).

def next_parameter_positional?: () -> false

This signature was generated using 1 sample from 1 application.

def next_parameter_positional?
  @partial_operation.positional_args.size < @operation_class.required_positional_parameters.size
end

def to_proc

def to_proc
  method(:call).to_proc
end