Like many programming languages, Ruby also provides a complete data structure to store and manage the objects. Arrays are created using square brackets and a single object reference list separated by commas.
presidents=["John", "Richard", "Gerald",
When you call a method, Ruby does two things.
1. Find this method. This method is called a method lookup.
2. Implement this method. To do this, Ruby needs something called self.
Such a process-discovering a method to execute-occurs in every
Ruby has three classes of variables, one constant, and two strict pseudo variables (pseudo-variables). There are no types for variables and constants. Although there are some drawbacks to the untyped variable, there are more advantages and good
Object-orientedis a very confusing language. It's all about being object-oriented and making people think you're trendy. Ruby claims to be an object-oriented scripting language, but what is "object-oriented"?We've got all kinds of answers, but all
Have seen "Ruby design mode" before, but gradually forgot. Now bought a big talk design pattern, it does not look so boring, by the way the code in Ruby implementation.
Simple Factory mode:
#-*-Encoding:utf-8-*-#运算类 class Operation
Installation of Ruby
Pay attention.
OS X or Linux is better
Implementation of different versions: C + +, C, Java
This time C Ruby
Installation method
Linux or OS X has pre-installed
Package Manager (APT, yum, Brew), not
JQUERY_UJS is a very important component for rails, and it is included in the default components of rails.
The jquery ujs contains some very handy features, such as confirmation dialog boxes, triggering Ajax, automatic Disable form submission
Numeric type (number)integral Type (integer)The integer type is divided into two, if within 31 digits (four bytes), that is the Fixnum instance. If more than, that is the Bignum instance.Integers range from-230 to 230-1 or-262 to 262-1. Integers in
When an HTTP response is a format that is different from the one in which it exists (XML and JSON), some additional formatting needs to be parsed, creating a format that you are accustomed to, and using it in a category. Idiomatic formats should be
IteratorDefined
A Ruby iterator is, simple A, can invoke a block of code.
Block is typically followed by method, and the code in the block does not necessarily execute
If there is a yield in method, the code in its block is executed
We may need to clean up when a method is finished. Perhaps an open file needs to be closed, the buffer data should be emptied, and so on. If there is always a single exit point for each method, we can safely place our cleanup code in a location and
Recently, a lot of people with rails to develop micro-trust project friends on the GitHub began to use Weixin_rails_middleware, weixin_authorize, but also many talked about Ratchet, Spring Festival began to now, has been doing micro-letter
%q
A string that replaces double quotes. When you need to put a lot of quotes in a string, you can use the following method directly without adding a backslash (\) to the quotation mark.
Copy Code code as follows:
>>%q (Joe said:
Files in the same directory, such as/USR/LOCAL/RUBY/FOO.RB and/usr/local/ruby/bar.rb two files.If you are directly in the FOO.RB
Require ' bar '
A bar.rb error cannot be found at execution time.This is because the running
/home/
Under Windows, we all know where the hosts file is, but in the Ubuntu system, there are other systems, such as the Android phone, and maybe there aren't as many small software that you can easily modify, so let's write it ourselves.
Large data operation involves data cleaning step or script processing is more convenient, the following introduction pig loading HDFs file calls Ruby script processing data, and then return data flow to the pig processing a simple case.
Note: Ruby
1, Ruby in the method name and variable name rules ( beginning with lowercase letters, the separation between words using "_",), but you can take the method name behind! (blockbuster method) or? (A Boolean type returns a value).
2, the method of
The SMTP (Simple Mail Transfer Protocol) is simply a mail Transfer protocol, a set of rules for sending messages from the source address to the destination to control how the letters are transferred.
Ruby provides net::smtp to send mail, and
Ruby provides two levels of access to the network, at the bottom you can access the operating system, it allows you to implement the client and server for the connection-oriented and connectionless protocol basic socket support.
Ruby Unified
Recently packaged servers have increased the number of APK packets, each manual RM operation too cumbersome, so spent a few minutes to write a can be specified in the directory according to the last modified time and wildcard matching for bulk
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