many friends in the Ruby language, because only contact, for the basic knowledge of Ruby do not know, such as Ruby on Rails installation and other basic tutorials, look at the installation Ruby on Rails tutorial (http://www.maiziedu.com/course/ruby/)
Essential Tools
Irb
Check Ancestors 1.9.3-p545:023 > String.ancestors
= = [String, comparable, Object, Kernel, Basicobject]
String There are four superiors in front of the Filtration Method
#DefineFrench_string ="il \xc3\xa9tait une fois"long_string= Eofhere isa long stringwith many paragraphseofputs long_string.empty?puts long_string.include?"many"puts French_string+long_string#concatenatehash = {Key1:"Val1", Key2:"Val2"}string=""str2=
Gsub ()The first parameter is Reg, and the second parameter is the character that is replaced.Returns the changed string with no side effects on the original string.No match will return the original string.irb(main):001:0"regWord"=>"regWord"irb(main)
Sometimes, we need the server to control the remote server to do some things, while stable and reliable, will not suddenly hang out or anything.Then Ruby is a great tool.# encoding:utf-8#!/usr/bin/ruby# encoding:utf-8# Port 1990# Browser access:
This is the source code in the book.File.foreach ('1.txt') do |x| if (($. = = 1) | | x =~/eig/). (($. = = 3) | | x =~/nin/) Then Print x endendWhere 1.txt content is as followsFirstsecondthirdfourthfifthsixthseventheigthninthtenthRead the
GEM is a file organization package, and many of the general Ruby Plugins are provided by this variety of packages. Let's take a look at the use of gemsRuby-v #查看ruby version ruby-e "require" watir "; Puts Watir::ie::version ' #查看watir版本RVM list
Explanation of the annotation usage and Chinese Encoding Problems in the Ruby language.
Ruby AnnotationThe annotation hides a line, a part of a line, or several lines from the Ruby interpreter. You can use the following characters at the beginning
Basic Ruby syntax and ruby syntax
There are multiple ways to create a String object. The most common method is to use the string literal (literals), that is, the character sequence between a group of single quotes or double quotes. The difference
Ruby implements modification of hosts and rubyubuntu under ubuntu
In Windows, we all know where to modify the hosts file, but in ubuntu, there are other systems, such as Android phones, maybe there aren't so many small software for you to simply
Explanation of the method_missing method in the Ruby metaprogramming dream, rubymethod_missing
I recently read some articles (such as this article) to promote the use of method_missing in Ruby.
Many people are in a fire with method_missing, but they
Ruby metaprogramming: creating your own dynamic methods and ruby programming Dynamics
Method_missing is a common method of Ruby metaprogramming. The basic idea is to call a non-existent Method for callback. A typical example is the dynamic query of
Ruby calculates the md5sum and rubymd5sum of the file while traversing the folder.
#! /Usr/bin/ruby-w # require 'digest/md5' if ARGV. empty? Puts "usgae: #$0 path" exit 0enddir_name = ARGV. shiftdef dir_md5sum (path) md5s = Array. new if File.
Tutorial on the usage of loop statements in Ruby and tutorial on the usage of ruby statements
The loop in Ruby is used to execute the same code block for a specified number of times. This chapter describes the loop statements supported by Ruby in
Introduce the knowledge of modules and mixed types in Ruby and ruby.
A module is a combination of methods, classes, and constants. Two main advantages of the module:
The module provides a namespace to avoid name conflicts.
The module implements
RVM Installation and Use Summary notes, rvm summary notes
Run the following command to install RVM:Copy codeThe Code is as follows:Bash
Then modify the user configuration file/Users/username/. profile. You can also write it to other global
Leetcode 17 Letter Combinations of a Phone Number, leetcode
Given a digit string, return all possible letter combinations that the number coshould represent.
A mapping of digit to letters (just like on the telephone buttons) is given
Parse Ruby variables in detail, and parse Ruby variables in detail
The location where the variable holds the data of the program to be used.
Ruby supports five types of variables. In the previous section, we have gone through a brief description and
Explain the exceptions in Ruby.
Exceptions and executions are always associated. If you open a non-existent file and do not properly handle this situation, your program is considered to be of low quality.
If an exception occurs, the program stops.
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