Ruby handles strings like numbers. We enclose them in single quotes (' ... ') or double quotes ("...").
Ruby> "abc"
"abc"
ruby> ' abc '
"abc"
Single and double quotes have different effects in some cases. A string enclosed in double quotes
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,
ROR Official website:http://www.rubyonrails.org/As a starting point for understanding the technology, there's a 15-minute video that builds a blog that's worth a visit.Rolling with Ruby on
source code layout aspect:1. All source files are encoded in UTF-82, using a 2-space indentation3. Use UNIX-style line breaks (\ n), Windows (\ r \ n). You can use git config--global core.autocrlf true to prevent Windows-style line breaks from being
First, the methodRuby's method definition allows you to set a default value for a parameter, but you cannot have a parameter without a default value after an argument with a default value (Allow * and &), meaning that the following method definition
Ruby parsing JSONRuby Parsing JSON Example:
JSON = ' ["A", "B", "C"] '
puts "Unsafe #{unsafe_json
(JSON). Inspect}"
#输出Unsafe
["A", "B", "C"]
Ruby parses JSON to parse the above JSON string into array. Such a method is not safe, for
Rexml is a library written by Sean Russell. It is not Ruby's only XML library, but it is a popular one and is written in pure Ruby (Nqxml is also written in Ruby, but Xmlparser encapsulates the Jade library written in C). In his Rexml overview,
Name the mails the Somethingmailer. Without Mailer, it is not immediately apparent which is a Mailer, and which view is related to it.Provides HTML and plain text view templates.
Enable mail failure to send error in your development environment.
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:
The Fruit class in the previous section has two real variables, describe the type and state of the fruit. Until a custom inspect method is written for this class, we understand that it does not make a reasonable explanation for a fruit that lacks
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
JRuby 1.7.14 Released, this version is now available for download:
Http://www.jruby.org/download
The JRuby 1.7 is designed to be compatible with the Ruby 1.9.3 version, and the improvement record is as follows:
Solved 30 issues.
Fixed a
The SMTP (Simple Mail Transfer Protocol) is simply a mail Transfer protocol, a set of rules for sending messages from the source address to the destination to control how the letters are transferred.
Ruby provides net::smtp to send mail, and
Ruby is a language with strong expressive power, this is proud of its extraordinarily rich operator and grammatical sugars, although Ruby has always been one of its philosophies with the least surprising principle, but it is often seen as a
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 =
For several days, ROR environment finally set up, in order to prevent later forget, less detours, special records
=============================================
installation process
1. Installation rubyinstaller-1.9.2
2, install the
To raise this question is to have an objective attitude towards the way of thinking.For the programming language, I have always felt that those I have not used, listening to some of the cows have mentioned the language is better.I have been to
Said is the use of pdfkit, in fact, the work is still wkhtmltopdf.First, the new projectRails New Mypdf--skip-bundleEnter project: CD mypdf, open Gemfile:vim gemfileModify Source to Https://ruby.taobao.comAdded: Gem ' Pdfkit 'Run Bundle
On the IIS site, "Handler mappings" click "Add script Map ..."Request Path: *.RBExecutable file: C:\Ruby22\bin\ruby.exe%s%sName: RubyClick OK if you are prompted with an error at this time:If you add a script map handler mapping, the Isapimodule or
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