Python and Ruby are currently very popular.Programming Language. They are ideal for building software prototypes. These two languages are also suitable for developing web applications.Program. The latest Ruby version is 1.9.2, and the latest Python
First, in ruby1.8, class variables are shared by all sub-classes and parent classes.Code:
Class intelligentlife @ home_planet = nil def self. home_planet @ home_planet end def self. home_planet = (x) @ home_planet = x end #... end class TerranWe
The ruby language contains a type called the range class, which is a set of a range of some classes. Generally ".. "or "... "To define the range ,".. "indicates the value that contains the defined range ,"... "does not include the value at the end
When using Ruby to output text to the console, Good coloring is necessary. The following describes how to output the colored text to the OS X terminal. In fact, it should also apply in Linux.
Originally, I only needed to post the link to the blog
I have written a simple unit test library for myself in Ruby over the past few days. It feels a little DSL.
It seems that there is no ruby format. Use Lua to make it together.
Sample Code:
Code highlighting produced by Actipro CodeHighlighter
Ror deployment methods are divided into front-end and back-end architectures:
I. Front-end
The frontend is used to process static resources, distribute dynamic requests to the backend, and sometimes provide some additional functions, such as
From: http://hi.baidu.com/waytofall/blog/item/dad928f9d042b65f242df222.html
Introduction to the MVC Architecture in Ruby on Rails
MVC was first proposed by Trygve reenskaug (seemingly a Norwegian, Professor at the University of Oslo,
Ruby Introduction
Ruby was written in and released in 95. It is an object-oriented programming scripting language.ProgramMember. Despite the recent surge in the suppression of Japanese goods, here I would like to cite Mr. Song benhong's insight
Ruby identifiers are used to point to constants, variables, methods, classes, and modules. The first letter of the identifiers helps us determine the scope of the content that the identifiers direct.
Ruby is case sensitive.
Ruby uses a convention
transfer character meaning:
serial number, for example, \ D [0-9] numeric character \ D [^ 0-9] Except for any number character \ s [\ s \ t \ n \ f blank character \ s [^ \ s \ t \ n \ f] any character except blank character \ W [A-Za-z0-9 _]
I have seen several articles about Ruby on Rails (ROR) recently.ArticleYou can't help but download a copy of it to try it out.
The reference document creates a very simple system and does not take much time, mainly because the scaffold function
Read an object and print it out:
Lines = file. open ('dom. js '). readlinesputs "=================================" lines. each {| Line | puts (line )}
Or:
File. Open ("dom. js") Do | file | while line = file. Gets puts line endend
The
Today, the original stable mood was touched by some things, and the feeling of deep-buried things being pulled up is always painful, not to mention too much, or concentrate on WritingArticleRight. Let's talk about the keywords in this article and
After eight days of returning home during the Spring Festival, I spent almost all of my time drinking, drinking, and having fun with my family, friends, and friends. When I returned to Beijing, I gave me some ruby-related news and paid more
Since rails was booming, the Ruby community has grown a lot better than before (younger brother, I also learned Ruby because of rails, various Ruby extension libraries have sprung up. Their features are that their versions are low (rarely 1.0) and
Matz is a professional software engineer working in netlab. JP, a famous open source company in Japan, and he is also a high-profile open source evangelist in Japan. He participated in several open-source software projects, including cmail. This is
Class String def has_one_in? (String_Arr) has = false string_Arr.each {| word | has = self. include? (Word) if has break end} has endenddef decode_subject (sub) if sub. include? ("B? ") Encode_str = sub. match (/= \? (.*?) \? =/). To_s
Recently I started to learn ruby. to practice the basic syntax, I used ruby to write an insert sorting algorithm, which may be a trace of translation from C #.
1. Insert sorting
Seq = [3, 4, 9, 0, 2, 5, 9, 7, 1]1. upto (seq. length-1) do | I |If
The String in Ruby is mutable, unlike the String in java and C # is immutable. For example
Copy codeThe Code is as follows: str1 = "abc"
Str2 = "abc"
In java, for literal strings, the jvm maintains a table internally. Therefore, in java, str1 and
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