I've seen the Ruby design pattern before, but I've forgotten all about it. Now buy a big talk design mode, it does not seem so boring, by the way the code with Ruby implementation.#-*-encoding:utf-8-*-#Operation classclassOperation
#Ruby Built-in basic data type Nilclass,tureclass,falseclass,time,date,string,range,struct,array,hash#Numerice 1. Divided into Interger integer class. Interger is divided into Fixnum and bignum. #2. #Float浮点数#3.Complex plural. #dynamic
Explanatory language, top-down execution, pure object-oriented, cross-platform, dynamic binding, no multiple inheritance.NetBeans Sun's developmentIRB instructions for fast real-time input and return results quit or exitRDoc hello.rb Generating HTML
Just contact Ruby, found that Ruby really strong, after so long Java, has been Java's tedious grammar of the entire language, especially Java exception, design out is a failure! Ruby is now up to 2.x, the community is active, and development
Require, load, and autoload are the methods defined in the kernel module. because both the class and the object class are mixed into the kernel module, you can call these methods whether self is an object or a class. These three methods are used
# Loads mkmf which is used to make makefiles for Ruby extensions require 'mkmf '# Give it a name extension_name = 'fsnet' dirs = ["/usr/local/lib"] $ libs + = "-Levent" $ libs + = "-levent_extra" $ libs + = "-levent_pthreads" $ libs + = "-ljemalloc"
We can think that module is a toolbox dedicated to storing a series of methods and constants.
The module and class are very similar, but the module cannot create an instance or have sub-classes. They can only store things.
For example:
module Circle
The ruby regular expression is a Regexp class object.Main metacharacters
Sn
Meaning
Example
Xiaoming
^
Header
/^ ABC/
ABC begin
$
End of line
/ABC $/
ABC too many rows
Encoding: undefinedconversionerror in productscontroller # create "\ xFF" from ASCII-8BIT to UTF-8
When uploading a photo using ruby1.9.3, this error is reported.
File. Open ("# {rails. Root}/APP/assets/images/" + new_name, "W") {| file |
File.
Define simple method
The keyword def is used for method definition, followed by a list of method names and optional parameter names. The list of parameter names is enclosed by a pair of parentheses. The code that constitutes the method subject is
Ruby concise learning notes (1): strings, numbers, classes and objects, ruby learning notes
To prove that Ruby is really easy to use, hello world can also be written so concisely:Copy codeThe Code is as follows:Puts 'Hello world'
1. Input/OutputCopy
Iiscnfg. vbs IIS configuration script, iiscnfg. vbsiis
Import and Export All or selected elements of the local or remote computer Internet Information Service (IIS) configuration database, or configure the entire IIS (configure the database and
The Ruby thread implements classic producer and consumer issues, and uses the Queue class in ruby to implement thread synchronization issues.
Copy codeThe Code is as follows:Require "thread"Puts "ProAndCon"Queue = Queue. new # Use the Queue queue
Ruby has powerful functions. The Ruby module Win32API we will introduce here is an additional library in the Ruby language. It can help us call Win32API directly.
Example of Ruby code for getting the current class name
Ruby module OpenURI to get
Ruby is a fully object-oriented interpreted scripting language. For such a new programming language, its features are very attractive to programmers. Let's take a look at the concepts related to Ruby threads.
How to call win32ole IN Ruby
Ruby
Recently, I was reading a Rails project and gradually came into contact with the Ruby language. Some of these concepts were confusing and ambiguous. I believe some people are just like me. They were not very clear about these concepts when they
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.