If a variable can only be used by an instance object, such variables are called instance variables. If a variable can be shared by all instance objects of a class, such variables are called class variables.
1) constants can be defined in classes
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
Go directlyCode:
# Encoding: utf-8class dungeon # create Get Set Method # Save the player and room list attr_accessor: Player def initialize (player_name) @ player = player. new (player_name) @ room = [] end # sets the player location attribute
After studying flex for a while, we found that actionscript3 is as dynamic as Ruby and can build very powerful clients. However, for some text-based systems, it is a bit cool-killing, however, in the future, the client is moving towards multi-media,
Using built-in database functions in Ruby to call orcale database is more troublesome, but fortunately the Open Source of the East expansion is very good, we can use the open source components of ruby-oci8 to orcale database for a series of
The ruby method can accept code blocks as parameters, which is a very flexible method and a very good design idea. Suppose there are three methods as shown in 1:
Figure 1
As shown in figure 1, a large number of code blocks of method A, Method B, and
It has been more than two months since I started to learn Ruby language dependencies. I feel that I have never gained a lot. I even read all the ruby language learning tutorials, however, there is always a sense of no way to start.
Ruby can also
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
3. identifier
An identifier is a name.An identifier consists of letters, numbers, and underscores, but cannot begin with a number. It cannot contain blank or non-printable characters, or punctuation marks.The identifier that starts with 26
I recently read the basic syntax section of [ironruby unleashed feb.2010] and found that "use a different..." appears in many places in the book.
Indeed, many basic operations in Ruby provide many methods/aliases, and many odd syntax (sugar ). In
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
Restful embodiment ---- Resource
Of course, it seems quite narrow to put restful and resource together. In rails, actioncontroller: Resources abstracts resources in rest. Here, I will not talk about the concept of rest, A huge amount of online
Development Environment:
OS: Windows XP
RUBY: ruby1.9.1
Rails: rails2.3.5
Will_paginate: will_paginate2.3.11
(Run the gem install mislav-will_paginate -- source http://gems.github.com in the command line)
IDE: rubymine2.0.1
DB: mysql5.0.9
This
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
Ruby class
Class inheritance
Polymorphism
Dynamic Language
Encoding
Ruby class
The first letter is capitalized. The instance variable name starts with @, and the method name and parameter name start with a lowercase
Ruby development configuration method:1. Before you start using Ruby, you must install (or verify that you already have) the Ruby interpreter and library, and Ruby development environment. Download: ruby186-25.exe2. Download the Eclipse plug-in:
Input and Output:
Standard input:
A = gets, gets is to get a row of data from the standard input, lines = readlines get multiple lines of content at a time until EOF (CTRL + D)
Puts a, puts is printed to the standard output
File input and
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
Ruby On Rails has been a hot topic recently On the Internet. Many people have given him the praise of the "alternative to Java Enterprise Application Development. Even a foreigner said on the Internet that a project with Java4 months was completed
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.