Most of Ruby's built-in types are similar to other programming languages. Mainly have strings,integers,floats,arrays and so on. However, only the scripting language,
such as Ruby,perl, and awk provide support for built-in expression types. Shame:
tend to the literal notation of arrays and hashes (unless you need to pass arguments to their constructors).
# bad
arr = array.new
hash = hash.new
# good
arr = []
hash = {}
You always use%w to define an array of strings
Ruby is filled with a series of hidden variables, and we can get some interesting information from these predefined global variables.
Global process variables
$$ represents the currently running Ruby process.
Copy Code code as follows:
Ruby provides a complete set of I/O-related methods that are implemented in the kernel (Kernel) module. All I/O methods derive from the IO class.
Class IO provides all the underlying methods, such as read, write, gets, puts, ReadLine, getc, and
Although I have encountered this problem in Python, it is easier to explain it in Ruby. In Ruby, there are many ways to traverse an array, and the two most commonly used are for and each:
Copy Code code as follows:
arr = [' A ', ' B ',
In the previous essay Ruby on Rails development from scratch (Windows) (ii)-Create project and first Hello World, we described how to use instantrails to create a project and write a simple HelloWorld page, Today on the basis of the last, write a
Many programs use a database that contains more than one table, and often there are relationships between tables, orders often contain multiple entries, and an item is associated with a commodity, a commodity may belong to multiple commodity
1. Install Xcode2. Download the following installation package from Oracle websiteInstantclient-basic-macos.x64-12.1.0.2.0.zipInstantclient-sdk-macos.x64-12.1.0.2.0.zip: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html3. Copy the
Brief introductionSometimes the following error occurs when installing CocoapodsERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.
1
This means that your ruby environment needs to be updated, and I'll
Ruby class class definition#!/usr/bin/rubyclass Sample def hello puts "Hello ruby!" Endend# uses the above class to create Object = Sample. Newobject.helloNote: A function call without arguments can be omitted ()Initialization method
I mainly use two plug-ins: rinari and Yari.
Rinari supports fast jump to multiple files in the rails project. In addition, it provides the grep tool, which I found useful. The shortcut keys are easy to remember.
Yari provides an Emacs interface
How to configure Ruby on Rails in ubuntu10.04 [from other blogs, refer to the first two webpages]
Http://www.baoyalv.info/blog/panjj/Rails/2010/05/01/76 (basic steps)
First, let's look at the alias. In Ruby, we can create an alias for the method or global variable. What's interesting is that after the method alias is defined, even if the corresponding method isCodeAfter a new definition (that is, an internal
If you are a student, you should be C, C ++ and Java. There will also be some VB, or C #/. net. You may have developed some web pages. You know some HTML, CSS, and JavaScript knowledge. In general, it is difficult for us to find that some students
Tutorial on Ruby on Rails Framework Program connecting to MongoDB, railsmongodb
We will introduce mongodb installation and setup of the ror project in the front. Now we will integrate it.
1. Create a project
Rails active_record support is no longer
A summary of the basic operation methods of the Hash structure in Ruby, rubyhash
About hashFirst, let's take a look at the basic ideas of Hash:If the number of objects to be stored is num, we will use len memory units to store them (len> = num). The
A summary of common functions of Time objects in Ruby and a summary of rubytime objects
Time object. Time. now returns the current Time.
1. Time.
Time. at (time [, usec])
Returns the time object of Time. time can be a Time object, or an integer or
Detailed description of matching and replacement operations on strings by regular expressions in Ruby, and ruby Regular Expressions
Regular Expression matching
Speaking of Ruby, of course, we need to mention its regular expression mechanism. As a
Ruby uses the Monkey Patch Monkey Method for program development example, rubymonkey
Monkey Patch is a special programming technique. Monkey patch can be used to dynamically modify (expand) classes or modules at runtime. You can add a Monkey Patch
GitHub advocates a summary of Ruby coding styles, while github advocates ruby code.
Source code layout: 1. All source files are UTF-8 encoded2. indent with two spaces3. Use Unix-style line breaks (\ n) and windows (\ r \ n ). You can use git config -
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