Tutorial Requirements
This tutorial requires the following technologies and resources:
A database server
NetBeans IDE 6.0 that supports Ruby
To create a sample database
Note: This tutorial uses the MySQL database server. For information about
Ruby Installation-LinuxThe following is a list of steps to install Ruby on a Linux machine.Note: Before installing, make sure you have root permissions.SOURCE InstallationDownload the latest version of the Ruby zip file. Please click here to
The range is everywhere: January to December, 0-9 days, 50 to 67 lines, and so forth. Ruby supports scope and allows us to use a range of ways:
As a sequence range
As a condition range
As an interval range
As a sequence range:
Ruby determines whether a number is primePrime numbers are also called primes. A natural number greater than 1, if it is not divisible by other natural numbers except for 1 and itself, (except for 0), otherwise known as composite numbers. According
Ruby has a lot of classic drive architectures, such as enumerators and generators, and so on. This brief introduction to the concept of the generator. The generator is a function-generated object, or a method of generating an object. The continuum
In the process of using ruby/rails, it is found that sometimes performance is unsatisfactory, such as the generation of a 3-layer tree with 600 items of the directory to spend 20ms, in order to improve performance in the learning to write Ruby
At last year's Yow Melbourne developer Conference, I attended some workshops. These workshops are the responsibility of the @coreyhaines and @rains, so TDD (test-driven development) is the main content of the discussion. It's usually not a problem,
Note one:The code contains variables, classes, and methods, collectively referred to as language constructs (language construct).
# TEST.RB
class greeting
def initialize (text)
@text = text
end
def welcome
@text
End
end
my_obj =
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
Sometimes it is convenient to be able to store any Ruby object directly in an attribute, in the same way that an active record supports serialization, transforms a Ruby object into a ymal string, and stores the string in the database field
Arrays in ruby are created by square brackets. The initial values can be placed in square brackets and separated by commas. array elements can be of different types and support addition and multiplication.
Ary = [1, 2, "3"]Ary * 2 Returns [1, 2, "
View
View is divided into builder mode and rhtml mode.
The following is an example of the builder mode.
XML. Div (: class => "productlist") DoXML. timestamp (time. Now)@ Products. Each do | product |XML. Product doXML. productname (product.
Parameterization is a commonly used technology in automated testing. It is painful to create a testing framework that does not support parameterization. Qtp already exists, But ruby-like watir and selenium are not supported because these frameworks
Create a new class and use the Dom. Factory method. Obviously, it is a factory method that produces various classes in batch.
VaR myfirstclass = Dom. factory ({message: "Hello World", sayhello: function () {alert (this. message) ;}}); var OBJ =
There is no constructor like C ++ or Ruby in Ruby, but we can still create multiple constructor similar to this:
Class coloredrectangle def initialize (R, G, B, S1, S2) @ r, @ g, @ B, @ S1, @ S2 = R, G, B, S1, s2 end def coloredrectangle. white_
Development Environment
OS: Windows XP
RUBY: ruby1.8.7
Rails: rails2.3.5
MySQL: mysql5.0.9
IDE: rubymine2.0.1
Preparations:
Install the following gem package
Gem install ruport
Gem install ruport-util
Gem install acts_as_reportable
In this
HTTPwatch official: http://www.httpwatch.com/rubywatir/
Ruby on httpwatch example: http://www.httpwatch.com/rubywatir/site_spider.zip (this example may be updated on the official website)
After this example is obtained, some Chinese comments are
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.