Ruby Programming
来源:互联网 发布:vb.net gridview 编辑:程序博客网 时间:2024/05/17 01:37
Ruby 基础
Ruby的特点如下:
1. Object Oriented
在ruby中,一切皆对象,所以的东西都可以称为对象,继承于Object, 即使是true和false变量。
2. Mixins
Ruby中有module, 类似于class, 但是module没有实例。 Module可以被mixed in 到其他的类中,相对于是对类方法的扩展。一个类可以扩展任意的module。
3. Dynamic
Ruby是动态语言, 不需要编译。可以在运行时随意改变程序中的定义,甚至可以扩展Int和String,这种特性叫做monkey patching(猴子补丁).
4. variables and scope
In Ruby , you do not need to declare the variable scope. The name of the ruby automatically determines its scope.
5. closures
Ruby中支持代码块,(在其他语言中被称为闭包)
二、脚本执行:
ruby hello_world.rb
Ruby的特点如下:
1. Object Oriented
在ruby中,一切皆对象,所以的东西都可以称为对象,继承于Object, 即使是true和false变量。
2. Mixins
Ruby中有module, 类似于class, 但是module没有实例。 Module可以被mixed in 到其他的类中,相对于是对类方法的扩展。一个类可以扩展任意的module。
3. Dynamic
Ruby是动态语言, 不需要编译。可以在运行时随意改变程序中的定义,甚至可以扩展Int和String,这种特性叫做monkey patching(猴子补丁).
4. variables and scope
In Ruby , you do not need to declare the variable scope. The name of the ruby automatically determines its scope.
x :local variable$x: Global variable@x: instance variable@@x: calss variable
5. closures
Ruby中支持代码块,(在其他语言中被称为闭包)
二、脚本执行:
2.1 在terminal上执行ruby程序可以:
ruby -e "puts 'Hello world'"
ruby hello_world.rb
#or
在irb中执行
0 0
- Ruby Programming
- Ruby Programming
- Programming Ruby-chapter 9
- Ruby Programming language
- Ruby Programming Language:
- Programming Ruby 读书笔记(一)
- Programming Ruby 读书笔记(二)
- Programming Ruby 读书笔记(三)
- Programming Ruby 读书笔记(四)
- Programming Ruby 读书笔记(五)
- Programming Ruby 读书笔记(六)
- Programming Ruby 读书笔记(七)
- Programming Ruby 读书笔记(八)
- Programming Ruby读书笔记
- Ruby的popen--《PROGRAMMING RUBY》读书笔记
- Programming in the Ruby language
- 《Programming Ruby中文版》Road Map
- The Ruby Programming Language Notes
- 算法学习之java实现快速排序
- logback MDC(Mapped Diagnostic Context)与分布式系统的跟踪系统
- Java Synchronized 略解
- linux-挂载数据
- 自我的学习反思
- Ruby Programming
- csu 1101
- 35. Search Insert Position
- Android混淆之ProGuard
- 【MFC-5】VS2010编程之文件对话框
- Hadoop+HBase+ZooKeeper分布式集群环境搭建
- HTML基础标签
- ORA-4031错误 解决方法
- linux学习笔记1