Optional ArgumentsSet default arguments, when we don ' t need to call it, we can simply skip it.def new_game (name, Year=nil, system=nil) { name:name, year:year, system:system = New_game ("Street figher II")Options Hash ArgumentSometimes,
The above rough introduction of the next Ruby, originally did not want to install this, because I was learning through the website, can be compiled online. But given the comprehensiveness of the content, try it.Refer to the next person's
Because you want to install the latest version, install it by compiling it.Prepare the tools and library files before installing:sudo Yum Install GCC gcc-c++ openssl-devel readline-devel gdbm-devel patchDownload file:Curl-o
When I started to learn Ruby, I couldn't figure out the difference between the symbol (the variable needs to add:) and the string, in order to design such a thing for the language. It makes me confused.First, the string object is different. For
Ruby is garbled in Chinese characters in cmd and does not support OpenSSL. rubyopenssl
Chinese garbled code SolutionYou cannot enter Chinese Characters in cmd.
Change the cmd code page to 936:
chcp 936
Ruby enforces UTF-8 for reading Chinese
Cloud 9 Adapt Project on Heroku (Week V), adaptheroku
Advanced Software Engineering
Week V
--------------- Write in front -------------------------
Https://moonsea.herokuapp.com/
Attach the link. This is the function to be implemented.
--------------
Ruby basic environment variable settings and common interpreter commands, ruby interpreter
Ruby Environment VariablesThe Ruby interpreter uses the following environment variables to control its behavior. The ENV object contains a list of all
Example of writing strings in Ruby, and example of ruby strings
String interpolation is preferred to replace String concatenation.
# bad email_with_name = user.name + ' ' # good email_with_name = "#{user.name} " # good email_with_name =
Analysis of the use of regular expressions in Ruby, analysis of ruby Regular Expressions
If you only need to search for the text of a string, do not use a regular expression: string ['text']
You can use string [/RE/] to query a simple structure.
Array and hash in Ruby.
The array (arrays) and hash (hashes) of Ruby are indexed collections ).
Both store the collection of objects and access them through keys. The key of the array is an integer. The hash List supports using any object as its key.
Rails Application Development
1. Bootstrap Installation
Add Gemfile:
gem 'bootstrap-sass', '~> 3.1.1'
Run the bundle install command line
App \ assets \ stylesheets \ adds the file bootstrap_and_overrides.css.scss. The content is
@import
One Usage Details of method_missing in ruby metaprogramming, rubymethod_missing
We know what the self of the top-level domain is?Copy codeThe Code is as follows:Puts self # mainPuts self. class # ObjectWe know that when a method is called, if no
The shortest editing distance calculation method implemented by Ruby, And the ruby Calculation Method
The dynamic planning algorithm is used to calculate the shortest editing distance.
Copy codeThe Code is as follows:# Encoding: UTF-8# Author: xu
For suggestions on Ruby on Rails view writing, rubyrails
Do not directly call the model layer from the view.Do not construct complex formats in the view and output them to a method or model of the view helper.Use the partial template and layout to
Notes for writing Ruby code Annotations:
Write the code of the self-explanatory document and let this part rest. This does not mean playing.Write comments in English.Use a space to separate comments from symbols.When more than one word is commented,
Explain the arithmetic operations in Ruby, and explain the Ruby arithmetic operations.
Ruby supports a modern language with a series of rich operators. Most operators are actually method calls. For example, a + B is interpreted as,+ (B) the method
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.