Often we need to store and get data in a more transparent way. The Marshal module provides a simple object persistence, and the Pstore library is built on this technology. The DBM Library is used as a hash and is permanently stored on disk.
1
By using the Hook method, you can allow us to intervene in the lifecycle of a Ruby class or module, which can greatly improve the flexibility of programming.The hook methods associated with the lifecycle are as follows:
Class is associated with a
An iterator is nothing but a collection of methods supported. An object that stores a set of data members is called a collection. In Ruby, arrays and hashes can be called collections.
The iterator returns all the elements of a collection, one after
Private
Private functions can only be invoked in the context of this class and subclass, and can only be accessed by self.
This means that the private function can only be accessed within this object.
The access rights of an object instance
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/
To prove that Ruby really works, Hello World can write so succinctly:
Copy Code code as follows:
Puts ' Hello World '
1. Input/output
Copy Code code as follows:
Print (' Enter your name ')
Name=gets ()
Puts
%{string} is used to create a string enclosed in double quotes%q{string} is used to create a string enclosed in double quotes
Copy Code code as follows:
Str=A string
End_of_string
%q! Some String of "Characters"! "Some
A regular expression is a special sequence of characters that matches or finds a collection of other strings or strings by using a pattern that has a specialized syntax.Grammar
A regular expression is literally a pattern between a slash or between
Tutorial Requirements
The following techniques and resources are required to learn this tutorial:
Database server
NetBeans IDE 6.0 with Ruby support
To create a sample database
This tutorial builds the relationship between the Rails model based
After cloning the project on the server, the local test shows "activerecord: connectionnotestablished"
This error occurs because the server wants to connect to the database and the database cannot be found,
At this point, we need to execute data
We are currently training our company on Ruby + cucumber (mainly testers). Our goal is to help people throughout the project master how to use Ruby + cucumber to compile testcase. there is no in-depth research on Ruby, but it is only necessary to
ProgramEncoding is generally divided into several situations:1. source code file encoding2. receive external Content Encoding3. Runtime Environment Code4. Operating System Code
First, you can add a line of declaration in the header of the Ruby
Ruby is...
A dynamic, open source programming language with a focus on simplicity and productifunctionality. It has an elegant syntax that is natural to read and easy to write.
Translate and organize documents of common Ruby libraries, and
I just posted a few songs in the music space and typed a few Ruby words.
Code Popularity
Require
'
Net/HTTP
'
Count
=
1
..
100000
#
Define an array
Count. Each {
#
Each
|
Index
|
#
Element is
"% 05d" % 123 the result is "00123""% 02x" % 10 returns "0a""% 03x" % 10 the result is "00a""% 010x" % 10 returns "000000000a" (9 prefixes 0)"% 10x" % 10 returns "a" (with a prefix of 9 spaces)
We can see that the first digit is the prefix,
Link: http://mislav.uniqpath.com/poignant-guide/book/chapter-2.htmlchapter 2: kon'nichi wa, Ruby Section 1: Open this book
Pretend that you have already opened this book (although you may have already opened this book), you only find that there is
From: http://developer.51cto.com/art/200908/147276.htm
It is difficult to install Ruby on Rails, but it is also very convenient. To develop applications based on Ruby, we must install Ruby, Gem, rails, and mongrel.
How to install Ruby on
Due to work relationships, I have never had time to learn Ruby. Recently, I finally had time to learn Ruby. I also opened a blog on csdn to record my learning experience, of course, it's not just Ruby. In recent years, dynamic languages have been
Recently, I am reading the ruby hacking Guide (the ruby source code is completely explained, and the ruby hacker has been fully explained.
I saw a team translating on the Internet. Unfortunately, I didn't find any good translation results, so I had
Communication between unicorn and nginx -- [ruby unix socket], unicornnginx
Article Source: [Chang Bo ke] http://www.xefan.com/archives/84146.html
Ruby application services are typically used together with a web service, such as nginx. When a
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