class String

def first(limit = 1)

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

def first: (?Integer limit) -> String

This signature was generated using 1 sample from 1 application.

str.first(6) # => "hello"
str.first(0) # => ""
str.first(2) # => "he"
str.first(1) # => "h"
str.first # => "h"
str = "hello"

given limit is greater than or equal to the string length, returns a copy of self.
from the beginning of the string until it reaches the limit value. If the
Returns the first character. If a limit is supplied, returns a substring
def first(limit = 1)
  self[0, limit] || raise(ArgumentError, "negative limit")
end