First, Introduction Ruby is an open-source, object-oriented programming server-side scripting language that was designed and developed by as まつもとゆきひろ/yukihiro Matsumoto in Japan in the mid 1990s. In the Ruby community, Matsumoto is also known as
Template mode is good, but it still has some flaws. For example, its implementation relies on inheritance and lacks sufficient flexibility. At this point we need to find a more optimal solution-the strategy model.The following is the report template
Demand:Shopping Center cash register software, according to the customer to purchase the item unit price and quantity, calculates the expense, will have the promotion activity, hits 80 percent, 300 minus 100 and so on.One, use Factory
ARGFAn Io object that connects all the files specified in the argv into a file. If argv is empty, then it represents standard input. Synonyms $ArgvAn array that contains all the parameters specified by the command line. Synonyms $*DATARepresents all
When I started to learn Ruby, I couldn't figure out the difference between the symbol (the variable needs to add:) and the string, in order to design such a thing for the language. It makes me confused.First, the string object is different. For
The main purpose of module is to put different methods and constants into different namespaces.
The module is named in the same initial capitalization as the class, with multiple words without underlining. such as: Circlearea
Module syntaxModule
OneOverview
Range represents a range in Ruby. Represents the method "..." and "...". The former indicates a closing interval:
The elements in range can be numbers, strings, and custom interval objects
(1..10). Each{|i| puts i} #1 2 3
First, take a look at the simple factory modelAdvantages of the Simple factory model: The factory class contains the necessary logical judgments, dynamically instantiating the relevant classes based on the client's choice, and, for the client, the
Chapter IIClass inheritance, properties, class variables1. How to declare a subclassclass Treasure This way the attribute name,description in the thing class is inherited by Treasure2. What are the parameters of the following three ways to pass in
The following is an example of how to use require IN Ruby: rubyrequire.
Files in the same directory, such as/usr/local/ruby/foo. rb and/usr/local/ruby/bar. rb.If it is directly in foo. rb
require 'bar'
Bar. rb is not found during execution.This is
Rails Application Development
1. Bootstrap Installation
Add Gemfile:
gem 'bootstrap-sass', '~> 3.1.1'
Run the bundle install command line
App \ assets \ stylesheets \ adds the file bootstrap_and_overrides.css.scss. The content is
@import
Ruby-based Merge Sorting Algorithm and ruby Sorting Algorithm
The assignment of an algorithm course uses the division and control method to merge and sort.
#encoding: utf-8#author: xu jin, 4100213#date: Oct 27, 2012#MergeSort#to sort an array by
Tutorial on using Net: SMTP to send emails in Ruby, rubysmtp
The protocol between the Simple mail Transfer Protocol (SMTP) for sending emails and the email server that routes the email.
Ruby provides the Net: SMTP Simple Mail Transfer Protocol (SMTP)
Grape entry, grapeseed
1. grape is a restful ruby microframework running in rack or used in combination with rails/sinatra. It simplifies APIs development by providing simple DSL (domain-specific language. it supports built-in general constraints
Method for creating a method alias with the same name as the "keyword" in Ruby
Begin and end are ruby keywords, but Range is also known as begin and end instance methods. Now the question is: how to create their aliases?
If you use class Range;
The basic usage of hash in Ruby, and the usage of Rubyhash
A set of hash key-value pairs, such as "employee" => "salary ". It is similar to an array, except that the index is any object type through any key, rather than an integer index.
Traversing
Ruby constant search path problem in-depth research, ruby constant
The constant path search problem in Ruby has been a problem that has plagued me all the time. I have encountered several times in my work and have never thoroughly figured out why. I
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