Class: Symbol
- Inherits:
-
Object
show all
- Includes:
- Comparable
- Defined in:
- lib/backports/3.0.0/symbol/name.rb,
lib/backports/1.9.1/symbol/size.rb,
lib/backports/1.9.1/symbol/succ.rb,
lib/backports/3.0.0/symbol/name.rb,
lib/backports/1.9.1/symbol/empty.rb,
lib/backports/1.9.1/symbol/match.rb,
lib/backports/1.9.1/symbol/length.rb,
lib/backports/1.9.1/symbol/upcase.rb,
lib/backports/1.8.7/symbol/to_proc.rb,
lib/backports/1.9.1/symbol/casecmp.rb,
lib/backports/1.9.1/symbol/downcase.rb,
lib/backports/1.9.1/symbol/swapcase.rb,
lib/backports/2.7.0/symbol/end_with.rb,
lib/backports/1.9.1/symbol/capitalize.rb,
lib/backports/1.9.1/symbol/comparable.rb,
lib/backports/1.9.1/symbol/comparison.rb,
lib/backports/2.7.0/symbol/start_with.rb,
lib/backports/1.9.1/symbol/element_reference.rb
Overview
For earlier Rubies, we can’t pool their strings
Instance Method Summary
collapse
Methods included from Comparable
#clamp, #clamp_with_range
Instance Method Details
#<=>(with) ⇒ Object
3
4
5
6
|
# File 'lib/backports/1.9.1/symbol/comparison.rb', line 3
def <=>(with)
return nil unless with.is_a? Symbol
to_s <=> with.to_s
end
|
#[](*args) ⇒ Object
3
4
5
|
# File 'lib/backports/1.9.1/symbol/element_reference.rb', line 3
def [](*args)
to_s[*args]
end
|
#capitalize ⇒ Object
3
4
5
|
# File 'lib/backports/1.9.1/symbol/capitalize.rb', line 3
def capitalize
to_s.capitalize.to_sym
end
|
#casecmp(with) ⇒ Object
3
4
5
6
|
# File 'lib/backports/1.9.1/symbol/casecmp.rb', line 3
def casecmp(with)
return nil unless with.is_a? Symbol
to_s.casecmp(with.to_s)
end
|
3
4
5
|
# File 'lib/backports/1.9.1/symbol/downcase.rb', line 3
def downcase
to_s.downcase.to_sym
end
|
#empty? ⇒ Boolean
3
4
5
|
# File 'lib/backports/1.9.1/symbol/empty.rb', line 3
def empty?
to_s.empty?
end
|
#end_with?(*suffixes) ⇒ Boolean
5
6
7
|
# File 'lib/backports/2.7.0/symbol/end_with.rb', line 5
def end_with?(*suffixes)
to_s.end_with?(*suffixes)
end
|
3
4
5
|
# File 'lib/backports/1.9.1/symbol/length.rb', line 3
def length
to_s.length
end
|
#match(with) ⇒ Object
Also known as:
=~
3
4
5
|
# File 'lib/backports/1.9.1/symbol/match.rb', line 3
def match(with)
to_s =~ with
end
|
9
10
11
|
# File 'lib/backports/3.0.0/symbol/name.rb', line 9
def name
Backports.symbol_names[self] ||= to_s.freeze
end
|
3
4
5
|
# File 'lib/backports/1.9.1/symbol/size.rb', line 3
def size
to_s.size
end
|
#start_with?(*suffixes) ⇒ Boolean
5
6
7
|
# File 'lib/backports/2.7.0/symbol/start_with.rb', line 5
def start_with?(*suffixes)
to_s.start_with?(*suffixes)
end
|
#succ ⇒ Object
Also known as:
next
3
4
5
|
# File 'lib/backports/1.9.1/symbol/succ.rb', line 3
def succ
to_s.succ.to_sym
end
|
3
4
5
|
# File 'lib/backports/1.9.1/symbol/swapcase.rb', line 3
def swapcase
to_s.swapcase.to_sym
end
|
4
5
6
|
# File 'lib/backports/1.8.7/symbol/to_proc.rb', line 4
def to_proc
Proc.new { |*args| args.shift.__send__(self, *args) }
end
|
3
4
5
|
# File 'lib/backports/1.9.1/symbol/upcase.rb', line 3
def upcase
to_s.upcase.to_sym
end
|