This article mainly introduces the circulation statement summary in Ruby, this article summarizes some commonly used in Ruby the cyclic syntax, the need friend may refer to the next
while (when ...) ) loop
While conditionStatement
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,
We've already completed a simple shopping cart, and from this start we'll see how to test in rails.
When we created the shopping cart program in our depot directory, there is already a test directory, which is for us to test preparation. So far, we'
In the last section, we added error handling to the shopping cart, this time to format the empty cart and amount.
To this moment we have not added any processing to the "Empty cart" link that displays the Shopping information list page. We first
Ruby contains "! "And no "! "The biggest difference between methods is that "! "Will change the calling object itself. For example, str. gsub (/A/, 'B') does not change STR itself, but only returns a new Str. Str. gsub! (/A/, 'B') will change the
Through the previous lecture, we have some knowledge about the basic framework of rest on rails, but how does it return different types of resource representations Based on the client request type? This is what we want to talk about. The secret lies
Class fixnum attr_accessor: valueendx = 1 p x. object_idx.value = "anleb" P x. value. object_iddef change (x) P x. object_id p x. value. object_id x = 2 # pointer change X. value = "mr. W "P x. object_id p x. value. object_id # x pointer changed
This is to setup a developement environment for Ruby 1.87 and rails 2.2.3 on Ubuntu 10.04 (LUCID ).[Sourcecode Language = "bash"]# Make sure Ubuntu is up to date$ Sudo apt-Get update$ Sudo apt-Get dist-Upgrade# Install Ruby$ Sudo apt-Get install
Gem packaging:
Gem build XXX. Rb
Install GEM:
Gem install XXX. Rb
For example:
Run-> cmd-> go to the folder to be packaged-> gem build install. RbInstal. RbCode
Code
Code highlighting produced by Actipro CodeHighlighter
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
Use netbeans debug RubyCode
Netbean debug Ruby
Debug Ruby code in netbeans
1. Get the gems package ruby-debug-ide-0.4.6.gem for ruby-debug-ide now I only see 0.4.6 and 0.4.5 available, and other high versions will always have issues
2.
In ruport, The pdf_writer does not support Chinese characters, and the output Chinese characters are garbled. I checked a lot of information online and did not find a good solution. I had to check the source code. Why does the PDF tool provided by
# Class describ ------ rdoc rules# = Headers# This is header content#== Sub Header# This is sub header content#=== Sub Header# This is sub HeaderClass animalAttr_accessor: name # ------------- ① # This is the comment for the 'new' method! Def
It may be a bit outdated, but the 12 tutorials provided by digitalmediaminute are still recognized as the classical required documents in the Ruby on Rails field --
A former student asked me a few days ago how I learned Ruby on Rails. the answer
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 %
Jira4r is a Ruby library used to operate the JIRA problem tracking system.Installation requirements (in Windows ):1. Ruby2. soap4r (gem install soap4r)3. jira4r (gem install jira4r)
If the 'xml processor module not found 'error message appears
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