module RedisClient::CommandBuilder

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

# sig/redis_client/command_builder.rbs

module RedisClient::CommandBuilder
  def generate: (Array[Symbol] args, ?Hash kwargs) -> untyped
  def generate: (Array[Symbol] args, ?Hash kwargs) -> untyped
end

def generate(args, kwargs = nil)

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

def generate: (String args, ? kwargs) -> untyped

This signature was generated using 1 sample from 1 application.

def generate(args, kwargs = nil)
  command = args.flat_map do |element|
    case element
    when Hash
      element.flatten
    else
      element
    end
  end
  kwargs&.each do |key, value|
    if value
      if value == true
        command << key.name
      else
        command << key.name << value
      end
    end
  end
  command.map! do |element|
    case element
    when String
      element
    when Symbol
      element.name
    when Integer, Float
      element.to_s
    else
      raise TypeError, "Unsupported command argument type: #{element.class}"
    end
  end
  if command.empty?
    raise ArgumentError, "can't issue an empty redis command"
  end
  command
end

def generate(args, kwargs = nil)

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

def generate: (String args, ? kwargs) -> untyped

This signature was generated using 1 sample from 1 application.

def generate(args, kwargs = nil)
  command = args.flat_map do |element|
    case element
    when Hash
      element.flatten
    else
      element
    end
  end
  kwargs&.each do |key, value|
    if value
      if value == true
        command << key.to_s
      else
        command << key.to_s << value
      end
    end
  end
  command.map! do |element|
    case element
    when String
      element
    when Integer, Float, Symbol
      element.to_s
    else
      raise TypeError, "Unsupported command argument type: #{element.class}"
    end
  end
  if command.empty?
    raise ArgumentError, "can't issue an empty redis command"
  end
  command
end