Configure the Ruby environment before installing cocoapods, this article summarizes how to install the ruby environment. Installing the ruby environment requires first installing Xcode and then installing homebrew, and then installing RVM to install
With the shell for Fur and ruby? Words can not say so, some small functions with Ruby is very convenient, such as the reversal of the string and add 1 function with Shell to write is more troublesome. str= "123456", we define a small way to reverse +
Point hereHttps://github.com/opal
Opal
Opal is a ruby to JavaScript Source-to-source compiler. It also have an implementation of the Ruby Corelib.
Opal is hosted on GitHub, and there are a freenode IRC channel at #opal, ask questions
Recently learning Ruby,ruby is an object-oriented programming language, and rails is the framework of Ruby, just like ssh in Java. It's just that rails is an MVC pattern. The following is a procedure for installing an environment.The main reference
Steps 1Install homebrew, install the package required for the system through itRuby-e "$ (curl-fssl https://raw.github.com/mxcl/homebrew/go/install)"After the installation is complete, brew doctor self-TestSteps 2Installing Curl-l Https://get.rvm.io
Sky = nilsky. nil? #=> TrueAll other objects are object. nil? All are false. If a database attribute is null, the attribute is. nil? #=> TrueEmpty? Used for string, array, and hash# Array []. Empty? #=> True # string "". Empty? #=> TrueBut "". Empty?
So far, it should have come to an end. There are a total of Essays. Simply add an integer and write it again.
IDE
Environment. AllCodeI use all of them
Ruby
Built-in Editor
Scite
Compiled
,
Inconvenient
,
With
Rails
There are
Ruby has the function facility to execute code saved as strings at runtime, the eval family method. Including kernel # Eval, object # instance_eval, Module # class_eval.
Kernel # eval
It is the most direct method
As follows:
1 p eval("2+2")2 3
To have the zh-CN.yml file, this can be downloaded on GitHub, someone else made
Gem for i18n Installation
Config. i18n. default_locale = "ZH-CN"
Add
Zh-CN:
Activerecord:
Attributes:
Product:
Title: "title"
Description: "Description"
Write a simple example
1. Create the following folder
Note: The lib directory must have a Rb file with the same name as your gem.
[Ruby]View plaincopy
$ CD Hola
$ Tree
.
├ ── Hola. gemspec
── Lib
└ ── Hola. Rb
2. write code
. Hola.
Ruby metaprogramming is worth noting.
Avoid infinite loop metaprogramming.
Do not confuse the core class (do not use monkey patch) when writing a function library ).
It is best to use the code block form in the string interpolation form.When you use
Ruby implements github third-party authentication and rubygithub third-party authentication
The code is very simple. There is no nonsense here.
# Coding: utf-8require 'sinatra 'require 'omniauth-github 'use Rack: Session: Cookieuse omniauth:
For details about return, break, and next in Ruby, rubyreturn
The use of the return, break, and next keywords involves the issue of jumping out of the scope. Their difference lies in the different scopes of different keywords jumping out, because
A summary of some basic syntax knowledge points in Ruby.
Let's write a simple ruby program. All Ruby source files will use the extension. rb. Therefore, put the following source code in a test. rb file.
#!/usr/bin/ruby -wputs "Hello, Ruby!";
Here,
Ruby uses the Continuous Object Continuation implementation generator, rubycontinuation
Ruby has many classic drive structures, such as enumerators and generators. this section briefly introduces the concept of generator. A generator generates an
Ruby-based watir-webdriver Automated Testing Solution and implementation (3), watirwebdriverThen the Ruby-based watir-webdriver Automated Testing Solution and implementation (2)Http://www.cnblogs.com/javame/p/4259468.htmlcontinue... to write a
Introduction to several methods for JavaScript to access CSS attributes, javascriptcss
JavaScript accesses CSS attributes in two ways: "access through elements" and "Access style sheets directly ". In addition, there is a problem that cannot be
Sidekiq in RailsIntroduction
Sidekiq is a multi-threaded background task processing system. Before it came out, a Resque product (made on Github) exists, because Resque is a multi-process model, therefore, when the number of tasks increases, the
What is the difference between new, collection, and member in Rails Routes? railsroutes
By default, there are seven RESTful routing verbs (index, show, create, new, edit, update, and destroy ). Sometimes we need to customize the route, then we need
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