One instance can be used to describe the problem
@ Title = "test"
P' #{@ title} '# Original output#=> "\#{@ title} "P "#{@ title} "# Calculate the value of the variable and convert it into a string output.#=> " test "# The content can also be
Do you want to feel the trouble-free installation of Ruby?
It doesn't matter. Now we have a try Ruby site, so long as you have a browser, you can use Ruby immediately. Try Ruby provides an interactive environment similar to Ruby's IRB, A brief Ruby
The most obvious feature of Dynamic Language is that the behavior/attribute of a class instance can be dynamically modified after the new version is released! I personally think this kind of processing is more in line with the real world than Java/C
1: I'm Sadek drobi, I'm here at qcon with Matsumoto yukihiro. Matz, can you tell us what you 've ve been up to lately?
Recently, I 've been working on the version 1.9, which is the Development version of Ruby, which is much faster than the stable
Ruby is a dynamic language that allows you to change the class definition at any time. For example, if a class already exists when we define it, the definition at this time is to append the previous class, rather than re-define it.
Code
ArticleDirectory
1.1 install Ruby
1.2 install rake and albacore
4.1, rakefile
4.2. Other functions provided by albacore
Microsoft tools are known for integration. automated building is generally based on Visual Studio or its
5Use other synchronization Technologies
Another synchronization mechanism is the monitor, which Ruby implements in the monitor. RB library. This technology is more advanced than mutex. In particular, mutex locks cannot be nested, but listener
Ruby require vs load vs include vs extend
In general:
Require vs load: require is loaded only once, and load may be loaded multiple times.
Include vs extend: the methods in the include module are the instance methods of the class, and the
Life cycle:
Yukihiro Matsumoto was born on February 1, April 14, 1965 in Tokushima Prefecture, Japan. In 1984, he studied at the Department of Information, the third discipline of zhubo University. Two years later, I will be absent from school and
This rexml library can be used for parsing XML documents in ruby.
The rexml library is an XML toolkit of Ruby. It is written in pure Ruby and complies with the xml1.0 specification.In ruby1.8 and later versions, the ruby standard library will
In addition to class, Ruby also supports module, which has two functions:1. namespace used as a group method and constant to prevent name conflicts2. Mixin classes can be mixed in. Instances of Mixin module classes have module methods.
If
Here we mainly use non-Greedy quantifiers. +? "Means matching any character until the first character is met"
In addition, find the matched group, as shown in figure X [0].
Require 'open-Uri 'Open ('HTTP: //
Local variables start with lowercase letters or underscores (_). Local variables do not include nil values before initialization like global variables and real variables.
Ruby> $ fooNilRuby> @ fooNilRuby> fooErr: (eval): 1: undefined local
I. Methods
The ruby method definition allows you to set default values for parameters. However, parameters without default values (* and &) cannot be followed by parameters with default values &), that is to say, the following method definition is
Now let's take the previous examples
Program Of
Code Let's take a look.
The following example is shown in the simple example section.
Def fact (N)If n = 01ElseN * fact (n-1)EndEndPrint fact (argv [0]. to_ I), "\ n"
Because this is the
The explanation is good. It should be clear a lot.
Ruby symbol details
Cause
Recently I have been studying Ruby on Rails. It is indeed an excellent database development framework. However, a large number of statements similar to the following are
As you know, ruby strings are called first-class objects and use a large number of query and operation methods. A basic string operation is to split a string into multiple sub-strings. If you have a string, such as "foo, bar, baz", and you want the
As ruby is a pure object-oriented language, everything is an object. methods are objects and classes are objects ..., therefore, self has many environments. Only by distinguishing the meanings of self in different environments can we better
The iterator was not invented by Ruby. it is widely used in various object-oriented languages. this is also true in Lisp. even so, the concept of iterator is not familiar to many people, so we will give a more detailed introduction here.You know,
Previously, we mentioned that Ruby has no functions, but only methods. There are actually more than one method. In this section, we will introduce access control (access controls ).Think about what happens when we define a method in the "highest
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service