Suddenly I found out that Ruby was good too, I was kind of thinking about learning
Introduced
This is a short introduction to Ruby and it takes only 20 minutes to complete the reading. This assumes that the reader has already installed Ruby, and if
Ruby books are not many, the following are all I collected from the network, download the direct click of the picture can be
Programming Ruby, Second Edition:ruby Primer, second edition, learning Ruby must read
Command mode is a design pattern with a higher rate of object behavior usage, alias: Action (Action), Transaction (transaction)
Intent: To encapsulate a request into an object so that you can parameterize different requests, queue or log request
Max method
b=[1,3,55,777,2,4,6,8,0]
For numeric data, Max gets the maximum value of the array, and Min gets the minimum value of the array.
B.max => 777
b.min => 0
There is no real meaning to the size of the string array
Brief introductionA single case pattern is one of the simplest forms of design patterns. The purpose of this pattern is to make an object of a Class A unique instance of the system. To do this, you can start by instantiating it from the client.
1. Installation RVM
Curl-l Https://get.rvm.io | Bash-s Stable
RVM is a command-line tool that provides management and switching of multiple versions of the Ruby environment, as well as different gemset depending on project management.
If
1. The class variable name begins with @@ 开始 and a class variable is shared by all instance objects of this class; the instance variable name begins with the @, each instance object has its own different instance variables;
2, class variables must
#!/usr/bin/ruby-w
#
require ' digest/md5 '
if argv.empty?
Puts "Usgae: #$0 path"
exit 0
End
dir_name=argv.shift
def dir_md5sum (path)
md5s=array.new
If File.directory? (path)
Dir.new (path). Each do |file|
Next
Regular expressions are a special sequence of characters that can help match or find other strings or string sets, using patterns that maintain a specialized syntax.
The regular expression literal is a pattern between a slash or any delimiter%r as
Ruby methods are very similar to functions in other programming languages, and Ruby methods are used to bundle one or more duplicate statements in one cell.
The method name should start with a lowercase letter. If the name of a method starts with
Variable holds the location where the data for the program to be used is stored.
There are five types of variables supported by Ruby. A brief description and these variables have been experienced in the previous chapters. These five types of
Built-in profiler implementation is very simple, in ruby2.2 only 150 lines of code, you can see its implementation profile.rb. The built-in profiler is very convenient to use, just add-rprofile parameters. For example:
Perform:
Some important differences between Ruby language and C # are:
1.ruby is a dynamic language, C # is a static language--that is, after the object is new, Ruby can also dynamically add some properties or methods to the object instance (JavaScript is
What is an accessor?We've discussed the real variables before, but not too much discussion. The real variable of an object belongs to its property and is a general difference from other objects from the same class. It is important to read and write
Implementation of PRY,RONIN,MSF similar terminal under the interactive function, where the main use of RIPL gem:
1. Ability to invoke defined methods, such as Help2. Ability to execute system commands3. Ability to perform Ruby language parsing like
Ruby, as an object-oriented language, must be involved in the operation of objects, this time it involves methods.
Call Method-Object. Method Name (argument 1, Argument 2, ..., argument N)
Classification of methods:
1. Instance method: As the
while (when ...) ) loop
While conditionStatement 1; Statement 2; Statement...End
Single While loop
(statement 1; Statement 2; Statement... ) While condition
Until (until ...) ) loop
Until condition = While not
Sass for the CSS to give the characteristics of dynamic language, such as variables, inheritance, operations, functions, etc., more convenient for the writing and maintenance of CSS!
Sass Installation
Because SASS relies on the ruby environment,
Begin and end are keywords for Ruby, but there is also an instance method with the name begin and end in range. Now the question is: How do you create their alias method?
If it doesn't work with class Range;alias begin_x begin end, Ruby thinks the
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.