In Files

  • mrbgems/mruby-symbol-ext/mrblib/symbol.rb
  • mrblib/symbol.rb

Symbol

Public Instance Methods

capitalize → symbol click to toggle source

Same as sym.to_s.capitalize.intern.

 
               # File mrbgems/mruby-symbol-ext/mrblib/symbol.rb, line 12
def capitalize
  (self.to_s.capitalize! || self).to_sym
end
            
casecmp(other) → -1, 0, +1 or nil click to toggle source

Case-insensitive version of Symbol#<=>.

 
               # File mrbgems/mruby-symbol-ext/mrblib/symbol.rb, line 42
def casecmp(other)
  return nil unless other.kind_of?(Symbol)
  lhs =  self.to_s; lhs.upcase!
  rhs = other.to_s.upcase
  lhs <=> rhs
end
            
casecmp?(other) → true, false, or nil click to toggle source

Returns true if sym and other_sym are equal after case folding, false if they are not equal, and nil if other_sym is not a string.

 
               # File mrbgems/mruby-symbol-ext/mrblib/symbol.rb, line 56
def casecmp?(sym)
  c = self.casecmp(sym)
  return nil if c.nil?
  return c == 0
end
            
downcase → symbol click to toggle source

Same as sym.to_s.downcase.intern.

 
               # File mrbgems/mruby-symbol-ext/mrblib/symbol.rb, line 22
def downcase
  (self.to_s.downcase! || self).to_sym
end
            
empty? → true or false click to toggle source

Returns that sym is :“” or not.

 
               # File mrbgems/mruby-symbol-ext/mrblib/symbol.rb, line 68
def empty?
  self.length == 0
end
            
to_proc() click to toggle source
 
               # File mrblib/symbol.rb, line 2
def to_proc
  ->(obj,*args,&block) do
    obj.__send__(self, *args, &block)
  end
end
            
upcase → symbol click to toggle source

Same as sym.to_s.upcase.intern.

 
               # File mrbgems/mruby-symbol-ext/mrblib/symbol.rb, line 32
def upcase
  (self.to_s.upcase! || self).to_sym
end