The ruby language has existed for a long time and has never been popular in China. Many people only know this language and there are few people. Every language has been developing for more than ten years and has become better and better. There must
An exception.
Find the rails file in the bin directory under the ruby installation directory, for example, C: \ ruby187 \ bin.Modify rails by addingRequire 'thread'
#! C:/ruby187/bin/ruby.exe # This file was generated by rubygems. # The
# To generate xml, you must create a rexml: document object instance. Require "Rexml/document" File = file. New ("test. xml", "W + ")# Create an XML file and write the following content .Doc = Rexml: Document. New # Create XML content # Add a node
Some people say that textmate is good, but this is suitable for MAC systems. In Windows, I started with editplus and started with Ruby syntax. In addition, the tree map with directories on the left is very friendly, that is, the files in each
An unexpected problem occurs in a running program. A file to be read does not exist. When you want to store some data, the disk is full. You may enter inappropriate data.
Ruby> file = open ("some_file ")
Err: (eval): 1: In 'open': no such file or
#a sudoku solver in Rubymodule Sudokuclass PuzzleASCII=".123456789"BIN="\000\001\002\003\004\005\006\007\010\011"def initialize(lines)if(lines.respond_to?:join)s=lines.joinelses=lines.dupends.gsub!(/\s/,"")raise Invalid,"Grid is the wrong size"
Smalltalk
Like smalltalk, Ruby is also a dynamic, object-oriented language. You do not need to specify the Data Type statically. Everything is an object. In addition, both have a garbage collection mechanism.
In smalltalk, flow control
Recently, I need a fast development language. Currently, the hot and fast development languages are Python and Ruby. Ruby and Python are both excellent scripting languages. Although their design philosophy is almost completely different, they are
3. identifier
An identifier is a name.An identifier consists of letters, numbers, and underscores, but cannot begin with a number. It cannot contain blank or non-printable characters, or punctuation marks.The identifier that starts with 26
Use will_paginate for paging and simple query
Run the gem install will_paginate command on the command line. The following result shows that the installation is successful.
Open books_controller.rb (your own Controller)
Comment out all the methods
Document directory
Ruby Module
Mix-in
Require and Load
Module Summary
Array
String
Regular Expression
Iterator, code block, Closure
Ruby Module
Ruby uses module... end to define a module. The module provides a namespace to prevent
Document directory
Ruby class
Class inheritance
Polymorphism
Dynamic Language
Encoding
Ruby class
The first letter is capitalized. The instance variable name starts with @, and the method name and parameter name start with a lowercase
Some time ago, I was working on an ERP project, and the performance of my notebook was poor (MB memory), so I could not do any development. In my spare time, I think of Ruby, a scripting language of interest. I had long wanted to explore Ruby, but
I wrote this article a long time ago. I can't find where the post is. I will try again. Because Google cannot search articles on oe.monweb.cn (this is a feature called Anti search engine)
However, I declare that ASE has nothing to do with the recent
1.Create Regular Expression
A) reg1 =/^ [a-z] * $/# Place the schema definition between two forward slashes and return a Regexp object
B) reg2 = Regexp. new ('^ [a-z] * $') # create a Regexp object
C) reg3 = % r {^ [a-z] * $} # Use the frontend %
Module:
The module definition is similar to the class, and the module keyword is used. However, a module cannot be instantiated or quilt-type. modules are independent and a module is an instance of a module class. The two most common functions of a
Self Context
Ruby's self is similar to Java's this, but is quite different. Java methods are referenced in the instance method, so this generally points to the current object. Ruby code is executed row by row, so the context self has different
Today, the following Program has made me struggle for a long time. The concept of private in Ruby is really strange...
Class Test private def test_print puts 'test' endendclass Test2 you cannot call endendTest2.new by adding self here. private
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