Ruby has several methods for outputting data to the console. The most common methods are P, puts, and print. I will check the differences between these methods every time I use them, but I forgot to do it some time later... So record it here. You
In many cases, when you design your applicationProgramYou may want to implement a method that is only used inside an object rather than other objects. Ruby provides three keywords to restrict access to methods.
· PRIVATE: Only methods
File structure rules1. If a rubyProgramContains a "shebang" comment, which is the first line. #! Note: to indicate how the (UNIX class) operating system executes the file.2. If a ruby program contains a "coding" comment and does not contain a
6.1 expression
Primary Expression
Numbers and strings are basic expressions.
Specific Keyword: True False nil self
The reference to variables is also a basic expression. The result of their evaluation is the value of the variable to which it
Ruby means "Ruby", while Ruby on Rails is the ruby that just pulled out of the mine and lie on the rails.
Ror (Ruby on Rails) is a web development framework based on the dynamic scripting language (Ruby). Its main application field is Web
Generally, the rdoc command is used for RubyProgramGenerate document
Eg:
Rdoc test. Rb
To generate a document for the RB file of the entire project, you only need to run the rdoc command without the file name.
Eg:
Rdoc
If there are classes and
The dynamic planning algorithm is used to calculate the shortest editing distance.
#encoding: utf-8#author: xu jin#date: Nov 12, 2012#EditDistance#to find the minimum cost by using EditDistance algorithm#example output:# "Please input a string: "#
Will_paginate (http://blog.csdn.net/kunshan_shenbin/article/details/4182610 ),
Now we plan to integrate it into rails3. In addition, the Code also includes jqgrid integration.
1. Open gemfile and modify it as follows:
gem 'rails', '3.2.13'#gem
Development Environment
OS: Windows XP
RUBY: ruby1.9.1
Rails: rails2.3.5
IDE: rubymine2.0.1
1. Create a rails Project
2. Modify/config/database. yml
In the automatically created Project, the default database is SQLite. If the database is not
Development Environment:
OS: Windows XP
RUBY: ruby1.8.7
Rails: rails2.3.5
MySQL: mysql5.0.9
IDE: rubymine2.0.1
1. Create productaggragator to implement data extraction logic. In this example, some parameters of product. report_table are
Transferred from [foreverphoenix column]
Number
1. Ruby supports integers and floating-point numbers. An integer can contain any length. An integer within a certain range is an object of the fixnum class. Integers out of the range are stored in
Document directory
Ruby Module
Mix-in
Require and Load
Module Summary
Array
String
Regular Expression
Iterator, code block, Closure
Ruby Module
Ruby uses module... end to define a module. The module provides a namespace to prevent
Document directory
Overload?
Super
Class variable (static variable)
Class Method (static method)
Singleton Method
Access Control
Overload?
Ruby supports default parameters, but there is no method overload in ruby.
Ruby supports
1. Determine the installation environment
Before installing jruby, determine the JDK version on the local machine. If you are using jruby 1.1.1, you can use JDK 1.4 (from the network, not personally proven). However, if you are using jruby 1.1.2,
# Encoding: UTF-8 # --------- dynamic execution # execute 2 + 2 puts eval "2 + 2" # = "4 # execute 15*2 (q indicates that double quotation marks will be calculated, Q indicates that single quotes are output as they are.) number = 15 code = % q {#
Here, we will talk about installing Ruby through apt-get, which will eliminate the need for self-compiling.
First, you must install both Ruby and ruby-dev when installing Ruby. The current version is 1.8, so you should execute the following command
In Ruby, thread objects are also used to represent threads.
Threads = [] 10. times do thread = thread. new do 10. times {| I | print I; $ stdout. flush; sleep rand (5)} End threads
The join here is different from the join in the array. The join
I wrote this article a long time ago. I can't find where the post is. I will try again. Because Google cannot search articles on oe.monweb.cn (this is a feature called Anti search engine)
However, I declare that ASE has nothing to do with the recent
From: http://galeki.is-programmer.com/show/183.html
Like other oo languages, in ruby, object functions are completed by sending messages to objects, such as Str. upcase is the message that sends upcase to str. The vertex operator (.), it is used to
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