Class method
The essence of a class method is a single piece method that lives in a single piece of the class. There are three ways to define them, respectively:
# method One
def Myclass.a_class_method end
# Two
class MyClass
def
Some time ago to see a lot of people write the next sister script, I also write a
Module Commonhelper
require ' Nokogiri '
require ' Open-uri '
def down_load_xmz
site_url = ' http:// Www.xxx.com "for
index_page in 1..141
The Observer pattern (sometimes referred to as the Publish/subscribe model) is one of the software design patterns.In this pattern, a target object manages all the observer objects that are dependent on it and actively notifies it when its state
Installation of Ruby
Pay attention.
OS X or Linux is better
Implementation of different versions: C + +, C, Java
This time C Ruby
Installation method
Linux or OS X has pre-installed
Package Manager (APT, yum, Brew), not
JQUERY_UJS is a very important component for rails, and it is included in the default components of rails.
The jquery ujs contains some very handy features, such as confirmation dialog boxes, triggering Ajax, automatic Disable form submission
Numeric type (number)integral Type (integer)The integer type is divided into two, if within 31 digits (four bytes), that is the Fixnum instance. If more than, that is the Bignum instance.Integers range from-230 to 230-1 or-262 to 262-1. Integers in
Avoid the metaprogramming of infinite loops.
Do not confuse the core class when writing a function library (do not use monkey patch).
code block forms are best used in string interpolation forms.When you use a string interpolation form, always
Write it out of the interpretation document code and let this part rest. It's not about playing.Use English to write notes.Use a space to separate annotations from symbols.Note more than one word should be capitalized and punctuation should be used.
1. Install Cocoapods,ruby version of the low-"start updating ruby-" began to update the gem, this is a no return AH comrades, all kinds of permission denied, various paths do not exist, various paths do not have read and write permissions, various
Try upgrading Ruby with RVMhttp://blog.csdn.net/lissdy/article/details/9191351If you encounter the following problemSearching for binary rubies, this might take some time.No binary rubies available for:osx/10.11/x86_64/ruby-2.2.4.Continuing with
Some difficulties in learning ruby language learning comprehension
The Ruby language is a relatively simple language because all of its design principles are object-oriented, so it's especially handy to use. Of course, the main reason is
The basic format of the If judgment is as follows:If condition then #then可省略 processing end1. Determine if the file exists#!/usr/bin/env rubyif file.exist? ("/etc/hosts") print "OK" endPlus Else#!/usr/bin/env rubyif file.exist? ("/etc/hosts") print "
#api New rulesRails New Companyname-projectname-web-api--api#gem New rulesBundle Gem Companyname-projectname-gem#ローカルgemのbuild & Install#ソース構造Companyname-cloud|--companyname-projectname-web-api|--companyname-common-gem#companyname-common-gemのgem
Ruby provides four types of variablesLocal variable: Lowercase letter or _ StartInstance variable: an instance variable can span a method of any particular instance or object, meaning that an instance variable from an object to an object is changed.
The definition is simple: the instance variable @ begins, class variable @@ at the beginning to read some articles and books, the current understanding of (in fact, still do not understand, first remember, the wrong to change):
Class
ref:https://www.ruby-lang.org/en/documentation/quickstart/#!/usr/bin/env rubyclass megagreeter Attr_accessor:names # Create The object def initialize (names = "World") @names = Names End # Say hi to everybody def say_hi if @names. Nil? Puts "...
The difference between Ruby learning notes-puts,p,printCommon denominator: Both are used for screen output.Different points:Puts the output will be wrapped (if the content parameter is empty, only one newline symbol is output), and if there is an
(1.. - do |x| if 5) end The use of the above flip-flop, you can be understood to be greater than or equal to 5 and less than or equal to 10 of the number printed out, that is understood as puts X if x >=5 && x but note you can not be written as
Introduction to rake and database data migration under Ruby on Rails, rubyrails
I don't know whether you have written data to the Migration file through Migration. I believe you have done this for both laruence And Newbie. In fact, this is not
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