Ruby (programming language)
Ruby is the name of a programming language that was created in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan. Like other programming languages, such as Python, its structure (the way it works) is very similar to the English language. It has these qualities:
- Terse. Short, but still easy to understand.
- Dynamic. Easy to change, anytime and anywhere.
- Duck typing. If you think you understand it, you probably understand it.
| Paradigm(s) | multi-paradigm: object-oriented, imperative, functional, reflective |
|---|---|
| Appeared in | 1995 |
| Designed by | Yukihiro Matsumoto |
| Developer | Yukihiro Matsumoto, et al. |
| Typing discipline | duck, dynamic |
| Scope | lexical, sometimes dynamic |
| Major implementations | Ruby MRI, YARV, Rubinius, MagLev, JRuby, MacRuby, RubyMotion, HotRuby, IronRuby, mruby |
| Influenced by | Ada,[1] C++,[1] CLU,[2] Dylan,[2] Eiffel,[1] Lisp,[2] Perl,[2] Python,[2] Smalltalk[2] |
| Influenced | D,[3] Elixir, Falcon, Fancy,[4] Groovy, Ioke,[5] Mirah, Nu,[6] Reia, Crystal |
| OS | Cross-platform |
| License | Ruby License or BSD License[7][8] |
| Usual filename extensions | .rb, .rbw |
| Website | www |
Many programmers like it because the creator tried to make it easy and nice to use.[9]
Ruby on Rails (RoR) is a web application framework that is implemented using the Ruby language.[10]
Example
An example Hello World program in Ruby: <syntaxhighlight lang="ruby"> puts "Hello World!" </syntaxhighlight> An example program in Ruby that asks for your name and then says it: <syntaxhighlight lang="ruby"> puts "What's your name?" name = gets.chomp puts "Ah hello there, #{name}" </syntaxhighlight> A function in Ruby that joins the 2 strings (or arrays/integers) into one, removes all numbers from it, capitalizes the string and then repeats it 5 times: <syntaxhighlight lang="ruby"> def somefunction(arg1, arg2) # creates a function with 2 arguments. the args can be called anything
arg = arg1 + arg2 # this joins them into 1 string
arg = arg.tr("1234567890","") # this replaces all the numbers with a nothing. erases them essentially.
arg = arg.capitalize # read that out loud
5.times do # read that out loud too
puts arg # prints it on a new line
end
end somefunction("h1e2l6lo7,"," W5o6r8l9d!3") # does the function </syntaxhighlight> Output: <syntaxhighlight lang="text"> Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! </syntaxhighlight>
Ruby (programming Language) Media
Yukihiro Matsumoto, the creator of Ruby
References
- ↑ 1.0 1.1 1.2 Cooper, Peter. Beginning Ruby: From Novice to Professional. Beginning from Novice to Professional (2009). Berkeley: Apress. p. 101. ISBN 978-1-4302-2363-4.
- ↑ 2.0 2.1 2.2 2.3 2.4 2.5 Bini, Ola. Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java (2007). Berkeley: APress. p. 3. ISBN 978-1-59059-881-8.
- ↑ Intro – D Programming Language 1.0 – Digital Mars
- ↑ Bertels, Christopher. Introduction to Fancy. Rubinius blog (23 February 2011)Engine Yard. Retrieved 2011-07-21.
- ↑ Bini, Ola. Ioke. Ioke.org. Retrieved 2011-07-21.
- ↑ Burks, Tim. About Nu™. Programming Nu™Neon Design Technology, Inc.. Retrieved 2011-07-21.
- ↑ COPYING in Ruby official source repository. Retrieved 2013-04-22.
- ↑ BSDL in Ruby official source repository. Retrieved 2013-04-22.
- ↑ About ruby.
- ↑ What is the difference between Ruby and Ruby on Rails?.
Other websites
| The English Wikibooks has more information on: |
| Wikiversity has more on: Topic:Ruby |
- Official website
- Ruby documentation site
- Ruby Draft Specification- Sep 2010 Archived 2012-03-22 at the Wayback Machine
- Wiki: Ruby language and implementation specification Archived 2013-04-11 at the Wayback Machine
- Ruby at the Open Directory Project