You create an array by listing the elements in square brackets and separating them from each other by commas. The array of Ruby can accommodate different object types
ruby> ary = [1, 2, "3"]
[1, 2, "3"]
Just like the string mentioned earlier.
Can ruby write a servlet? Yes, it's not funny, and it's handy, because Ruby's standard library brings a webrick,webrick itself and a Serlvet container, and it's convenient to start a Web server anytime, anywhere.
First look at the simplest example,
This article mainly introduces Ruby to realize producer and consumer code sharing, this article directly gives the implementation code, the need for friends can refer to the following
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
This article mainly introduces the example of Ruby optimization inheritance class, this article directly gives an example of optimization and implementation code, the need for friends can refer to the following
In the rails principle there is the
Before we tested model and controller, we learned some common test methods, and now we're going to delve into a few topics about testing. The first is to use a mock object.
In many cases, our program and the actual environment have dependencies,
In the previous essay, we completed the deletion of a table product, you must have noticed that we have not added any validation, such as price, we can enter any character, without error prompts. This time, let's take a look at how to add the
When I started my ruby journey, I wrote my study notes for people with other OO language experiences. Let's take a look at the magic ruby.
The first sample! First meeting.
#
! /Usr/bin/ENV Ruby
Class
MegagreeterAttr_accessor: names
This note is used to help understand the "The ruby language allows us to define classes based on an object so that we can expand the behavior of an object separately. The example is as follows:Test = "hello" # normal string
Normal = A. DUP # normal
Will ozzzzzz die in Java? A standard to measure the mainstream industrial languages in the future is put forward, one of which is very interesting:
Ozzzzzz writes 1. Writing should be standardized, rather than creating different styles like C.
Java
Contributed by Brian Leonard, maintained by Gail ChappellDecember 2007[Revision number: V6.0-6]
In this tutorial, you use the ruby support in the netbeans ide To create and run a simple web application. the example shows how to create a ruby web log.
Recently, I finally took some time to study ha automated testing. Some time ago, I initially determined the design direction of automated testing and started to use Ruby as the script language and watir as the design tool, conducts automated testing
Statement: This article is not an article about nodejs and Ruby on Rails. It only describes the reasons behind the thinking and decision-making in our decision-making process. The two frameworks are both excellent and both of them are well designed.
Author liubin http://www.ruby-cn.org/IOC (inversion of control), that is, the inversion of control in Chinese, is also called di (dependency injection), that is, dependent injection. In Java, there are many such containers, such as spring. There are
1. Write CGI
A simple CGI program is as follows:
#! /Usr/bin/ENV RubyPrint "HTTP/1.0 200 okrn"Print "Content-Type: text/htmlrnrn"Print "Hello world! RN"
We can use Ruby to process submitted parameters, fill templates, generate HTML, and so on, but
1. Send email via SMTP
Every week, Holden Glova, Pat eyler, and Phil Thomson submit a ruby Weekly News (RWN) article to the ruby garden website (http://www.rubygarden.org. A ruby script receives this article via email, converts it from the original
Currently, ruport supports output in PDF, HTML, CSV, and TXT formats. What if you want to print. xml and. Bat reports?
This example uses the XML format as an example to implement another custom application of ruport: formatter.
Ruport application
# Code source: http://rubyer.me/blog/917. you can easily learn four kinds of closures of Ruby: blocks, procs, Lambdas, and methods.
# Firstclass array def iterate! Self. each_with_index do | N, I | self [I] = yield (n) end endendarray = [1, 2, 3, 4]
Ruby tips Thor
Http://asciicasts.com/episodes/242-thorSinatra
Sinatra is a set of micro-web small frameworks that combine small Web apps or for Web Services. It is neither MVC nor built-in Orm. The most important thing is that it provides a set of
As a good programmer, you should be clear about the benefits of the Ruby on Rails development framework. Here we will introduce some tips for installing Ruby on Rails locally.
Many documents describe how to use the gem (one-click Ruby installer is
A loadrunner was developed a few days ago to use tesseract-ocr to identify the verification code. Although the recognition accuracy is not too high, some verification code images cannot be recognized, however, the correct verification code can also
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