Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 31 additions & 41 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -11627,13 +11627,15 @@ sym_match_m_p(int argc, VALUE *argv, VALUE sym)
}

/*
* call-seq:
* sym[idx] -> char
* sym[b, n] -> string
* sym.slice(idx) -> char
* sym.slice(b, n) -> string
* call-seq:
* symbol[index] -> string or nil
* symbol[start, length] -> string or nil
* symbol[range] -> string or nil
* symbol[regexp, capture = 0] -> string or nil
* symbol[substring] -> string or nil
*
* Equivalent to <tt>symbol.to_s[]</tt>; see String#[].
*
* Returns <code>sym.to_s[]</code>.
*/

static VALUE
Expand All @@ -11643,11 +11645,13 @@ sym_aref(int argc, VALUE *argv, VALUE sym)
}

/*
* call-seq:
* sym.length -> integer
* sym.size -> integer
* call-seq:
* length -> integer
*
* Equivalent to <tt>self.to_s.length</tt>; see String#length.
*
* Symbol#size is an alias for Symbol#length.
*
* Same as <code>sym.to_s.length</code>.
*/

static VALUE
Expand All @@ -11657,10 +11661,11 @@ sym_length(VALUE sym)
}

/*
* call-seq:
* sym.empty? -> true or false
* call-seq:
* empty? -> true or false
*
* Returns +true+ if +self+ is <tt>:''</tt>, +false+ otherwise.
*
* Returns whether _sym_ is :"" or not.
*/

static VALUE
Expand Down Expand Up @@ -11737,17 +11742,10 @@ sym_swapcase(int argc, VALUE *argv, VALUE sym)

/*
* call-seq:
* sym.start_with?([prefixes]+) -> true or false
*
* Returns true if +sym+ starts with one of the +prefixes+ given.
* Each of the +prefixes+ should be a String or a Regexp.
* start_with?(*string_or_regexp) -> true or false
*
* :hello.start_with?("hell") #=> true
* :hello.start_with?(/H/i) #=> true
* Equivalent to <tt>self.to_s.start_with?</tt>; see String#start_with?.
*
* # returns true if one of the prefixes matches.
* :hello.start_with?("heaven", "hell") #=> true
* :hello.start_with?("heaven", "paradise") #=> false
*/

static VALUE
Expand All @@ -11758,15 +11756,11 @@ sym_start_with(int argc, VALUE *argv, VALUE sym)

/*
* call-seq:
* sym.end_with?([suffixes]+) -> true or false
* end_with?(*string_or_regexp) -> true or false
*
* Returns true if +sym+ ends with one of the +suffixes+ given.
*
* :hello.end_with?("ello") #=> true
* Equivalent to <tt>self.to_s.end_with?</tt>; see String#end_with?.
*
* # returns true if one of the +suffixes+ matches.
* :hello.end_with?("heaven", "ello") #=> true
* :hello.end_with?("heaven", "paradise") #=> false
*/

static VALUE
Expand All @@ -11776,10 +11770,11 @@ sym_end_with(int argc, VALUE *argv, VALUE sym)
}

/*
* call-seq:
* sym.encoding -> encoding
* call-seq:
* encoding -> encoding
*
* Equivalent to <tt>self.to_s.encoding</tt>; see String#encoding.
*
* Returns the Encoding object that represents the encoding of _sym_.
*/

static VALUE
Expand Down Expand Up @@ -11824,18 +11819,13 @@ rb_to_symbol(VALUE name)

/*
* call-seq:
* Symbol.all_symbols => array
* Symbol.all_symbols -> array_of_symbols
*
* Returns an array of all symbols currently in Ruby's symbol table:
*
* Returns an array of all the symbols currently in Ruby's symbol
* table.
* Symbol.all_symbols.size # => 9334
* Symbol.all_symbols.take(3) # => [:!, :"\"", :"#"]
*
* Symbol.all_symbols.size #=> 903
* Symbol.all_symbols[1,20] #=> [:floor, :ARGV, :Binding, :symlink,
* :chown, :EOFError, :$;, :String,
* :LOCK_SH, :"setuid?", :$<,
* :default_proc, :compact, :extend,
* :Tms, :getwd, :$=, :ThreadGroup,
* :wait2, :$>]
*/

static VALUE
Expand Down