Ruby Symbols Description

Matter related to the old and new Ruby programmer, and Ruby’s symbols are confusing sometimes or always. Smoothly before this, can not get used is pretty. People learn about the Ruby language is often Rubionreiruzu learn from the project. The Rubionreiruzu symbol is everywhere. There really is everywhere. So, pay attention to the concept of a symbol of ruby, it’s important to remember that.
Ruby is an instance of a symbol of class symbol. Put before the identifier symbol following the colon, “: name”, “: id” or “: user”. Ruby Symbol class includes a method of a class.

  1. all_symbols – Returns an array of all the symbols currently in Ruby’s symbol table.
  2. id2name – Returns the name or string corresponding to sym:, name.id2name the “name” back.
  3. inspect – Literally back to the symbol.
  4. to_i – Return a unique integer to each symbol. This method never raises an exception.
  5. to_s – id2name as same. Returns the string.
  6. to_sym – Returns the symbol corresponding to string.

Permanent link to this article: https://blog.openshell.in/2010/11/ruby-symbols-description/

Leave a Reply

Your email address will not be published.