[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-detail-673334-en":59,"doc-seo-673334-105":80},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":5,"data":60},{"doc_id":61,"user_id":62,"nickname":63,"user_avatar":64,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":66,"doc_content":67,"file_id":68,"file_url":69,"file_type":70,"file_size":71,"view_count":8,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":34,"language":72,"language_code":73,"site_id":74,"html_lang":73,"table_of_contents":75,"faqs":76,"seo_title":77,"seo_description":66,"update_tm":78,"read_time":79},673334,1099514068035,"Ezra","https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c","The Ultimate Ruby Cheatsheet - Quick Reference for Writing Ruby Programs","The Ultimate Ruby Cheatsheet provides a compact, practical overview of core Ruby concepts needed to write Ruby programs effectively. It explains fundamental data structures and types including Strings, Hashes, Symbols, Nil, Arrays, Enumerable, and regular expressions, along with Ruby Gems and object-oriented classes. The guide also covers key Ruby features for readability and syntax, including variables, types of variables, special percentage-based literal syntax, and when to use parentheses with method arguments and precedence.","The Ultimate Ruby Cheatsheet  \n\n| Learning Ruby can be overwhelming with all the bits & pieces you have to remember. That's why I put together this reference for you!\u003Cbr>It will help refresh your memory & quickly review what you need to know to write Ruby programs.\u003Cbr>Have fun!\u003Cbr>Strings |\n| --- |\n| A string is a sequence of characters inside two quotation marks ( \"\" ) . Used to represent text & data.\u003Cbr>Example:\u003Cbr>\" I like chocolate \"\u003Cbr>You can also use single quotation marks ( ' ' ) .\u003Cbr>Important methods:\u003Cbr> size\u003Cbr> empty?\u003Cbr> include?\u003Cbr> gsub\u003Cbr> split\u003Cbr>More methods:\u003Cbr>[https://www.rubyguides.com/2018/01/ruby-string-methods/](https://www.rubyguides.com/2018/01/ruby-string-methods/)\u003Cbr>Hashes |\n\nA hash ( {} ) is a key-value pair ( a => b ) data structure. Used as a dictionary. You can access hash elements by their keys. Keys are unique.  \nExample:  \nh = { a: 1 , b : 2 , c: 3 }  \n\\# Access  \nh [ :a]  \n\\# Set  \nh [ :test] = 10  \nImportant methods:  \n key?  \n fetch  \n new (for default values)  \n merge  \nMore methods:  \n[http://ruby-doc.org/core-2.6.4/Hash.html](http://ruby-doc.org/core-2.6.4/Hash.html)  \nSymbol  \n\n| A static string used for identification, one common example is hash keys. They always start with a colon ( : bacon ) . Symbols are never used for their content (the individual characters) .\u003Cbr>Learn more:\u003Cbr>[https://www.rubyguides.com/2018/02/ruby-symbols/](https://www.rubyguides.com/2018/02/ruby-symbols/)\u003Cbr>Nil |\n| --- |\n| A singleton class (only one object allowed) that represents a default or \"not found\" kind of value.\u003Cbr>Evaluates to \"false\" in a conditional context.\u003Cbr>Learn more:\u003Cbr> [https://www.rubyguides.com/2018/01/ruby-nil/](https://www.rubyguides.com/2018/01/ruby-nil/)\u003Cbr> [https://www.rubyguides.com/2019/02/ruby-booleans/](https://www.rubyguides.com/2019/02/ruby-booleans/)\u003Cbr>Array |\n\nAn object used to represent a list of objects. An array can contain any kind of object ( a =[1 , \"abc \" , []] ), including other arrays.  \nYou access array elements with their index ( a [0 ] ) & nested arrays with a [0 ][0 ] . Important methods:  \n size  \n empty?  \n push / pop  \n join  \n flatten  \nMore methods:  \n[http://ruby-doc.org/core-2.6.4/Array.html](http://ruby-doc.org/core-2.6.4/Array.html)  \nEnumerable  \n\n| A Ruby module used to iterate over the elements of any class that implements the each method, like Array, Range & Hash.\u003Cbr>Important methods:\u003Cbr> map\u003Cbr> select\u003Cbr> inject\u003Cbr>More:\u003Cbr>[https://www.rubyguides.com/2016/03/enumerable-methods/](https://www.rubyguides.com/2016/03/enumerable-methods/)\u003Cbr>File |\n| --- |\n| A class that helps you work with files in Ruby. Anything from reading them, writing to them or even getting info about them, like the file size.\u003Cbr>Important methods:\u003Cbr> read\u003Cbr> write\u003Cbr>More:\u003Cbr>[https://www.rubyguides.com/2015/05/working-with-files-ruby/](https://www.rubyguides.com/2015/05/working-with-files-ruby/)\u003Cbr>Regular Expression |\n\nIf you're looking to find patterns, substrings, or something specific inside a string, then a regular expression may be what you're looking for.  \nThey can be used to validate email addresses & phone numbers. Or to extract information from text.  \nExample:  \n\"aaaa1 \" .match?(/[0-9]/)  \n\\# true  \n\"\" .match?(/[0-9]/)  \n\\# false  \nLearn more:  \n[https://www.rubyguides.com/2015/06/ruby-regex/](https://www.rubyguides.com/2015/06/ruby-regex/)  \nRuby Gems & Bundler  \nRuby gems are packages you can download to use in your Ruby programs. These packages give you new functions.  \nFor example, in Rails you can easily add authentication with the Devise gem, or pagination with the Kaminari gem.  \nLearn more:  \n[https://www.rubyguides.com/2018/09/ruby-gems-gemfiles-bundler/](https://www.rubyguides.com/2018/09/ruby-gems-gemfiles-bundler/)  \nClasses & Object-Oriented Programming  \nRuby is an Object-Oriented Programming language. We think of everything as an object. Objects are created from their blueprints, classes.  \nObjects can know things & do things. You tell ob","cbCaigsrGj0VpNhy","https://ap.wps.com/l/cbCaigsrGj0VpNhy","pdf",148836,"English","en",105,"# Strings\n# Hashes\n# Symbol\n# Nil\n# Array\n# Enumerable\n# File\n# Regular Expression\n# Ruby Gems & Bundler\n# Classes & Object-Oriented Programming\n# Types Of Variables\n# Use of Parenthesis","[{\"question\":\"What does a Ruby String represent and how do you define it?\",\"answer\":\"A String represents a sequence of characters inside quotation marks. It can be created with double quotes (\\\" \\\") or single quotes (' ').\"},{\"question\":\"How does a Ruby Hash store data and how do you access elements?\",\"answer\":\"A Hash stores key-value pairs like (a =\\u003e b) and keys are unique. You access elements using their keys, for example h[:a].\"},{\"question\":\"When should you use parentheses in Ruby syntax?\",\"answer\":\"Parentheses are not required, but they help with method arguments and operator precedence. Use parentheses with method arguments and around expressions to change precedence.\"}]","The Ultimate Ruby Cheatsheet - Quick Reference for Writing Ruby Programs | PDF",1793630684,18,{"code":4,"msg":81,"data":82},"ok",{"site_id":74,"language":73,"slug":83,"title":65,"keywords":84,"description":66,"schema_data":85,"social_meta":139,"head_meta":141,"extra_data":143,"updated_unix":78},"the-ultimate-ruby-cheatsheet-quick-reference-for-writing-ruby-programs","",{"@graph":86,"@context":138},[87,101,121],{"@type":88,"itemListElement":89},"BreadcrumbList",[90,94,96,99],{"item":91,"name":92,"@type":93,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":95,"name":9,"@type":93,"position":14},"https://docshare.wps.com/document/",{"item":97,"name":30,"@type":93,"position":98},"https://docshare.wps.com/document/technology/",3,{"item":100,"name":65,"@type":93,"position":19},"https://docshare.wps.com/document/the-ultimate-ruby-cheatsheet-quick-reference-for-writing-ruby-programs/673334/",{"url":100,"name":65,"@type":102,"image":103,"author":108,"headline":65,"publisher":110,"fileFormat":113,"inLanguage":73,"description":66,"dateModified":114,"datePublished":115,"encodingFormat":113,"isAccessibleForFree":116,"interactionStatistic":117},"DigitalDocument",{"url":104,"@type":105,"width":106,"height":107},"https://docshare.wps.com/thumbnails/the-ultimate-ruby-cheatsheet-quick-reference-for-writing-ruby-programs/673334.png","ImageObject",300,407,{"name":63,"@type":109},"Person",{"url":91,"name":111,"@type":112},"DocShare","Organization","application/pdf","2026-11-03","2026-11-02",true,{"@type":118,"interactionType":119,"userInteractionCount":8},"InteractionCounter",{"@type":120},"ViewAction",{"@type":122,"mainEntity":123},"FAQPage",[124,130,134],{"name":125,"@type":126,"acceptedAnswer":127},"What does a Ruby String represent and how do you define it?","Question",{"text":128,"@type":129},"A String represents a sequence of characters inside quotation marks. It can be created with double quotes (\" \") or single quotes (' ').","Answer",{"name":131,"@type":126,"acceptedAnswer":132},"How does a Ruby Hash store data and how do you access elements?",{"text":133,"@type":129},"A Hash stores key-value pairs like (a => b) and keys are unique. You access elements using their keys, for example h[:a].",{"name":135,"@type":126,"acceptedAnswer":136},"When should you use parentheses in Ruby syntax?",{"text":137,"@type":129},"Parentheses are not required, but they help with method arguments and operator precedence. Use parentheses with method arguments and around expressions to change precedence.","https://schema.org",{"og:url":100,"og:type":140,"og:title":65,"og:site_name":111,"og:description":66},"article",{"robots":142,"canonical":100},"index,follow",{"doc_id":61,"site_id":74}]