Contenu connexe
Similaire à The ruby-way (20)
The ruby-way
- 1. HA
PP
Y
CO
DI
NG
This is Ruby!
- 8. class Application
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
- 10. import java.io.InputStreamReader;
import java.io.BufferedReader;
class Application
{
public static void main(String[] args)
{
System.out.println("What is your name?");
String name = "";
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(input);
try
{
name = reader.readLine().trim();
}
catch(Exception e) { ; }
System.out.println("Nice to meet you, " + name + '!');
}
}
- 11. puts "What is your name?"
name = gets.chomp
puts "Nice to meet you, #{name}!"
- 12. a = 10
puts 'a is #{a}'
puts "a is #{a}"
# output:
# a is #{a}
# a is 10
- 20. 开始玩 Ruby
● Http://tryruby.org
● Http://ruby-lang.org
● Http://railsinstaller.org
- 22. 理念
● 不要计较于字节、毫秒,优化的事情应该交给计
算机去做
● 专注于你要解决的问题
- 23. ●
默认就有的实用方法和类
● alias :不用纠结命名
●
自动化工具
● Rake
● RubyGems
● Bundler
● ...
- 26. ● Ruby 程序员
● 20+ repo
●
画家
- 29. 模板引擎
● Erb
● Markdown 系 :Rdiscount 等
● HAML
● ...
- 37. Oh,
● Github 是用 Ruby on Rails 写的
● 几乎所有的 Ruby 项目都在 Github 上托管