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
I,
Create a file
F = file. new (file. join ("C:", "test.txt"), "W +") F. puts ("I am Jack") F. puts ("Hello World ")
File Mode
"R": Read-Only. Starts at beginning of file (default mode ).
"R +": Read-write. Starts at beginning of file.
A strange problem was found during Ruby writing yesterday.
We call the shell command in Ruby. Usually we can enclose the shell command by using parentheses (the one on the left of the number key 1), for example:
'LS-l'
This lineCodeIs a string
1. Check whether the private method can be inherited.
Class A @ name = "anleb" def ask puts @ name end private: askenda =. new #. aska. send (: Ask) Class B
Conclusion: for private methods, class variables (similar to static variables,
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
First, we need a simple view for our index defined in Part 1
Index. rhtml in views/login
here comes the content which
Will be used after the user logged on.
This is just some dummy content that will be "blocked" by a modal extjs
Regular Expression
Most of Ruby's built-in types and otherProgramming LanguageVery similar. Mainly include strings, integers, floats, and arrays. However, only the script language,
Such as Ruby, Perl, and awk provide support for built-in
In RubyProgramYou will often see some variables starting with $. These are not the global variables we set in the program, but the variables that have been set inside the system, they represent some specific meanings. Some common internal variables
Write a record of the Ruby Blog system. It is also a bit of a record for me to learn Ruby.
First, I will introduce my learning environment.System: ubuntu12.04Documents: techotopia, Ruby documents, the hard way learn Ruby and other documentsRecord:
SELF: indicates the current object or default object in ruby. At any time of program execution, there is only one self.
1. Who is self and where is self?
To know which object is self, you must know the current context. The context mainly includes
In Ruby, how does one perform Chinese Word Segmentation search?
This issue is currently under consideration,Target is to useFerret,Ferret is the ruby version of Lucene search engine. With a little Lucene experience, I personally like ferret very
Code: URL, search content, text verification points are all made into variables; open IE, enter www.baidu.com, enter the search content "watir", click submit, and query the results, use the text verification point Content to verify the Content
Test cases are similar to the Menu above, a total of 9
First look at the Element Definition (yaml ):
# Channel switching-channel_0_link: div (: class, 'navmenubg '). li (: id, 'num _ 2 '). link (: href, 'HTTP: // beijing.xxxx.com/xxxshi')
In the previous content, we created the order Model and the representation page. This time, we will continue to compile the CHECKOUT process.
1. On the checkout. rhtml page, there is a CHECKOUT button that has not been written for it last time.
Solution to pod problems after upgrading to mac 10.10, 10.10pod
I was curious about the latest powerful features of mac 10.10, So I upgraded the system to 10.10. I found that the following problems occurred when using the
1. If print does not automatically wrap the line, puts will automatically wrap the line. If one line is not enough to write, you can add "\" to connect.Ruby code
Puts 6/2 print 6/1 puts 'Hello world' puts. We are all '\ 'China'Running result:
Ruby
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,
PrivatePrivate functions can only be called in the context of the class and subclass, and can only be accessed through self.This means that the private function can only be accessed within the object.The access permission of the object instance
You can create an array by listing elements in square brackets and separating them with commas (,). The Ruby array can adapt to different object types.Ruby> ary = [1, 2, "3"][1, 2, "3"]Just like the string mentioned above, Arrays can be multiplied
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