Ruby Prep Work

Source: Internet
Author: User
Tags uppercase letter

Explanatory language, top-down execution, pure object-oriented, cross-platform, dynamic binding, no multiple inheritance.
NetBeans Sun's development
IRB instructions for fast real-time input and return results quit or exit
RDoc hello.rb Generating HTML documents
Rdoc-f CHM generates CHM documents, relies on the month Microsoft HTML Help Workshop
Gem Ruby Package Management
Gem List List of packages already installed
Gem Install install package
Gem Uninstall uninstalling the installation package
Gem Query Search Package
Gem Help usage assistance
Rebyscript2exe and Exerb can be a tool to transform Ruby into a separate executable file for off-environment.

Naming rules

Local variables start with lowercase letters or underscores.
Global variables start with dollar sign $.
The instance variable begins with @.
Class variables start with @@.
A constant or class name begins with an uppercase letter.

Key words

Module Modules Definition
Class
Def,undef method
Defined? Check type
If,then,else,elsif,case,when,unless conditional statements
For,in,while,until,next (Continue), Break,do,redo (repeats the current cycle), retry (repeats the entire iteration loop), yield loop statement
Not,and,or Logic Judgment
Nil null value
Rescue,ensure Exception Handling
Super,self Object reference
Begin/end the beginning of the block
Begin,end Embedded Module
_file_,_line_ file Related
Alias aliases
Nil is similar to the null in C #, where Ruby has only nil and false for false, and all other expressions are true in logical judgment.

Public,protected,private subclasses can only access protected in protected and private,c# that use the parent class internally

classBaseClassdefpublic_m1 () puts"Basepublic"End protecteddefprotected_m2 () puts"baseprotected"End PrivatedefPrivate_method () puts"baseprivate"EndEndclassmyclass<BaseClassdefcall_basepublic () public_m1 Enddefcall_baseprotected () protected_m2 EnddefCall_baseprivat () Private_method endend#baseclass=baseclass.new#Baseclass.private_method Private Cannot access#baseclass.protected_m2 is protected and cannot be accessedmyclass=MyClass.newmyclass.call_baseprivatmyclass.call_baseprotectedmyclass.call_basepublic

Ruby Prep Work

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.