ruby

Ruby is an object-oriented programming language developed by Yukihiro Matsumoto. Ruby is a dynamic programming language with a complex but at the same time expressive grammar. Ruby also has a core class library with a rich and powerful API.

Ruby是由Yukihiro Matsumoto开发的一种面向对象的编程语言。 Ruby是一种动态编程语言 ,具有复杂但同时具有表现力的语法

Ruby is inspired by other low level and object oriented programming languages like Lisp, Smalltalk, and Perl

Lisp , Smalltalk和Perl等其他面向对象的低级编程语言的启发,并且使用的语法易于C和Java程序员学习。

Ruby, a dynamic and open source programming language with a focus on simplicity and productivity, has an elegant syntax that is natural to read and easy to write.

Ruby是一种动态且开源的编程语言,其重点是简单性和生产率,它具有优雅的语法,易于阅读和编写。

Although it's easy to program in Ruby, it is not a simple language.

尽管使用Ruby编程很容易,但它不是一种简单的语言。

(Features of Ruby)

  1. Object Oriented :面向对象:
  2. Dynamic :动态:
  3. Singleton Classes : Every object in Ruby has two classes: a regular class and a singleton class. An object's singleton class is nameless class whose only instances is that object. Singleton classes are created automatically and make Ruby simple and elegant. 单例类: Ruby中的每个对象都有两个类: regular class和singleton class 。 对象的单例类是无名类,其唯一实例是该对象。 Singleton类是自动创建的,使Ruby简单而优雅。
  4. Metaprogramming :元编程:
  5. Flexibility :灵活性:无需子类就可以将方法添加到现有类中,可以重载运算符,甚至可以在运行时重新定义标准库的行为。
  6. Variables and scopes :变量和范围:程序员无需在ruby中声明变量或变量范围。 变量的名称自动确定其范围。

Examples :

var is a local variable.

$var is a global variable.

@var is an instance variable.

@@var is a class variable.

例子 :

var是局部变量。

$var是全局变量。

@var是一个实例变量。

@@var是一个类变量。

(Ruby: Advanced Features)

  • Exceptions for handling errors. 处理错误的异常。
  • Garbage Collector. 垃圾收集器。
  • OS - independent threading, which allows you to write multi-threaded applications even on operating systems such as DOS. 操作系统-独立的线程,即使在DOS等操作系统上,也可以编写多线程应用程序。
  • You can write extensions to Ruby in C. 您可以在C中为Ruby编写扩展。

(Why you should go for Ruby?)

  • Ruby is a server-side scripting language. Ruby是一种服务器端脚本语言。
  • Ruby can be embedded into HTML. Ruby可以嵌入到HTML中。
  • Ruby has similar syntax to that of many programming languages like C and Java. Ruby的语法与C和Java等许多编程语言的语法相似。
  • Ruby supports mostly all the platforms like Windows, Mac and Linux. Ruby几乎支持所有平台,例如Windows,Mac和Linux。
  • Ruby can be easily connected to Oracle, MySQL, DB2. Ruby可以轻松连接到Oracle,MySQL,DB2。

翻译自: https://www.studytonight.com/ruby/introduction-to-ruby

ruby