Ruby 程序员的挚友
历史背景[1]
诞生于1993年2月24日的Ruby(红宝石),由日本人松本行弘(Yuki Matsumoto)于1994年12月发布。 Ruby 作为一种纯面向对象的脚本程序设计语言,吸收了Smalltalk和Perl两种程序语言的特性。
Ruby理念[2]
1.首先考虑的是,减少编程时不必要的琐碎时间,令编写程序的人高兴;
2.其次是良好的界面设计;
3.强调系统设计必须人性化,而不是一味从机器的角度设想。
Linux中安装Ruby[3]
依赖于您所使用的Linux发行版本,有一些安装Ruby的方法。首选方法是简单地下载源代码并亲自编译。而在一些操作系统平台中,用安装包管理解决方法,可以极其简单地安装Ruby。
例如,在Debian或Ubuntu中apt-get工具提供了一种简易而优美的解决方案:
% sudo apt-get install ruby1.9.1-full
上述命令安装目前稳定的Ruby版本1.9.1。如果您喜欢安装Ruby1.8版本,您可以使用以下命令安装:
% sudo apt-get install ruby-full
程序示例
#!/usr/bin/env ruby
# hello.ry
puts "Hello, world!"
端中输入以下命令:
$chmod a+x hello.ry
$hello.ry
结果输出显示是:
Hello, world!
资源
Ruby官方网:http://www.ruby-lang.org/en/
Ruby正体中文网:http://www.ruby-lang.org/zh_TW/
Ruby简体中文网:http://www.ruby-lang.org/zh_cn/
Rails中Ruby程序设计指南:
http://www.meshplex.org/wiki/Ruby/Ruby_on_Rails_programming_tutorials
参考文献
1.维基百科http://zh.wikipedia.org/wiki/Ruby
2.Ruby官方网站http://www.ruby-lang.org/en/
相关文档:
原文连接: http://hi.baidu.com/%B7%CF%B2%C5%CB%FB%B8%E7/blog/item/09c19411244152daf7039ec4.html
通过命令行查看ruby版本信息:
ruby -v
命令行运行程序:
方法1.
ruby -e 'print "hello ruby"'
-e 表示将后面的一行作为ruby程序
print 是ruby的一个内置函数
方法2.交互编译环境
irb (命令行输入后, ......
env setup
linux(ubuntu)下ruby开发环境搭建,包括一些常见问题解决
注意,本文只是我在搭建ruby学习环境时的一些笔记,因为是用gedit编辑的,所以格式化不是很好,另外,只是备忘而已。
2010.1.19
1. install ruby
$ tar xzf ruby-1.8.7-p248.tar.gz
$ mv ruby-1.8.7-p248 ruby187
$ cd ruby187/
$ ./configure
......
文章转自 http://www.ej38.com/showinfo/Ruby-140367.html
过程如下:
1、ruby下载一键安装:
http://rubyforge.org/frs/download.php/29263/ruby186-26.exe
ruby -v 显示版本,安装成功
2、下载rubygems安装:
http://rubyforge.org/frs/download.php/60719/rubygems-1.3.5.zip
解压,ruby setup.rb
g ......
phpRPC + Ruby + Arduino = 遠程控制LED開關(?)
嗯,我知道這是個很無聊的Sample :P
關於phpRPC與Arduino請自行Google
觀看此demo之前請先安裝另外一篇所提到的serialport
與另外一個Gem
套件:phprpc
在這個ļ ......
To get it done is not easy. I spent a whole day to figure out the various compatibility issues along the way out.
Now there still might be potential issues, but it works by my rough test.
Step 1: Install Apache Cassandra
You may know that the Ruby gem cassandra will do it for you.
  ......