[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / symbol.rb
blobbfac11ae21b21dd13cb5220709a18b55153aecdc
1 class Symbol
2   # call-seq:
3   #   to_s -> string
4   #
5   # Returns a string representation of +self+ (not including the leading colon):
6   #
7   #   :foo.to_s # => "foo"
8   #
9   # Related: Symbol#inspect, Symbol#name.
10   def to_s
11     Primitive.attr! :leaf
12     Primitive.cexpr! 'rb_sym_to_s(self)'
13   end
15   alias id2name to_s
17   # call-seq:
18   #   to_sym -> self
19   #
20   # Returns +self+.
21   #
22   # Related: String#to_sym.
23   def to_sym
24     self
25   end
27   alias intern to_sym
28 end