instance method
Symbol#to_s
() -> ::String
to_s → string
symbol.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/symbol.rb, line 10
def to_s
Primitive.attr! :leaf
Primitive.cexpr! 'rb_sym_to_s(self)'
end
Returns a string representation of self (not including the leading colon):
Example
:foo.to_s # => "foo"
Related: Symbol#inspect, Symbol#name.
Ruby version changes
-
3.4
-
The string returned by
Symbol#to_snow emits a deprecation warning when mutated, and will be frozen in a future version of Ruby. These warnings can be enabled with-W:deprecatedor by settingWarning[:deprecated] = true. [Feature #20350]
-