Skip to content
Browse files

Adding Ruby introduction

  • Loading branch information...
1 parent 4092a13 commit dc34411a4cd2cd34f284b9a3d2835c55925b9881 @Sayanc93 Sayanc93 committed
Showing with 97 additions and 1 deletion.
  1. +96 −0 Ruby-Introduction.md
  2. +1 −1 Ruby.md
View
96 Ruby-Introduction.md
@@ -0,0 +1,96 @@
+# Introduction
+
+[Previous](Ruby)
+
+[Home](Ruby)
+
+## What is Ruby?
+
+[Ruby](Ruby) is an interpreted scripting language for quick and easy object-oriented programming. Which means-
+
+- ability to make operating system calls directly
+- powerful string operations and regular expressions
+- immediate feedback during development
+- variable declarations are unnecessary
+- variables are not typed
+- syntax is simple and consistent
+- memory management is automatic
+- everything is an object
+- classes, methods, inheritance, etc.
+- singleton methods
+- "mixin" functionality by module
+- iterators and closures
+
+If you are unfamiliar with some of the concepts above, read on, and don't worry. The mantra of the ruby language is quick and easy.
+
+## Version
+
+The current stable version is 2.3.0. It has various performance improvements and syntactic additions from its predecessor, ruby v2.2.4.
+
+## Installation
+
+ Mac OS X and many Linux distributions come pre-installed with Ruby. To check if ruby is pre-installed in your system, just run `ruby -v` on your shell. There are several ways to install Ruby:
+
+- When you are on a UNIX-like operating system, using your system’s package manager is the easiest way of getting started. However, the packaged Ruby version usually is not the newest one.
+- Installers can be used to install a specific or multiple Ruby versions. There is also an installer for Windows.
+- Managers help you to switch between multiple Ruby installations on your system.
+- And finally, you can also build Ruby from source.
+
+To know about how to install Ruby through package managers, installers and source, click [here](https://www.ruby-lang.org/en/documentation/installation/). RVM (Ruby Version Manager) and rbenv are the most popular Ruby managers to manage multiple Rubies. If you get stuck anywhere, don't worry, just head over to our [Gitter chat room](https://gitter.im/FreeCodeCamp/ruby) and ask us anything.
+
+## IRB
+
+IRB stands for Interactive Ruby Shell. The abbreviation irb comes from the fact that the filename extension for Ruby is ".rb", although interactive Ruby files do not have an extension of ".irb". The program is launched from a command line and allows the execution of Ruby commands with immediate response, experimenting in real-time. It features command history, line editing capabilities, and job control, and is able to communicate directly as a shell script over the Internet and interact with a live server. It was developed by Keiju Ishitsuka.
+
+```ruby
+irb
+2.3.0 :001 > print "Hello World"
+Hello World! => nil
+```
+
+## Ruby Interpreter
+
+The Ruby interpreter is what is used to run Ruby scripts. If it is available and in Unix shell’s search path makes it possible to start it by typing the command `ruby` followed by the script name will invoke the interpreter and run the script.
+
+`hello_campers.rb`
+
+```ruby
+if 'welcome' == 'welcome'
+ print('Hello campers!')
+end
+```
+
+From command-line:
+
+```ruby
+$ ruby hello_campers.rb
+Hello campers!
+```
+## Documentation
+
+Ruby is well [documented](https://www.ruby-lang.org/en/documentation/). These docs include tutorials, guides, references and meta information for language.
+Another important resouce for documentation is [Ruby Doc](http://ruby-doc.org/core-2.3.0/). You should visit this [link](https://github.com/airbnb/ruby) to know more about Ruby style guide, written by developers of AirBnB.
+
+## Debugging
+
+Inline `print` statements can be used for simple debugging:
+
+> **... often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.**
+
+
+Ruby also includes more powerful tools for debugging, such as:
+* [*pry-debugger*](https://github.com/nixme/pry-debugger)
+
+## Hello World!
+
+Going back to the docs, we can read about the [`print`](http://ruby-doc.org/core-2.3.0/Kernel.html#method-i-print) method, one of the built-in methods of the [the Kernel module](http://ruby-doc.org/core-2.3.0/Kernel.html).
+```ruby
+print(obj, ...) → nil
+```
+Prints each object to $stdout. Objects that aren’t strings will be converted by calling their `to_s` method. The return value of print is `nil`. So when you run ``print "Hello World!`` in your IRB. The output is:
+
+```ruby
+2.3.0 :001 > print "Hello World!"
+Hello World!
+ => nil
+```
View
2 Ruby.md
@@ -6,7 +6,7 @@
[Ruby](https://www.ruby-lang.org/en/) is a dynamic, object-oriented, [reflective](https://en.wikipedia.org/wiki/Reflection_(computer_programming)) programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. It also has a dynamic type system and automatic memory management.
-Known for its [syntactic sugar](https://en.wikipedia.org/wiki/Syntactic_sugar), Ruby is made for developers happiness. It was created by a Japanese software engineer, [Yukihiro Matsumoto](https://en.wikipedia.org/wiki/Yukihiro_Matsumoto) in the early 1990s (also popularly known as Matz) as a simple general purpose scripting language for his day-to-day work. Combining elements of Perl, Smalltalk, and Scheme in a simple yet powerful syntax.
+Known for its [syntactic sugar](https://en.wikipedia.org/wiki/Syntactic_sugar), Ruby is made for developer's happiness. It was created by a Japanese software engineer, [Yukihiro Matsumoto](https://en.wikipedia.org/wiki/Yukihiro_Matsumoto) in the early 1990s (also popularly known as Matz) as a simple general purpose scripting language for his day-to-day work. Combining elements of Perl, Smalltalk, and Scheme in a simple yet powerful syntax.
Ruby was conceived on February 24, 1993. In a 1999 post to the ruby-talk mailing list, Ruby author Yukihiro Matsumoto describes some of his early ideas about the language:

0 comments on commit dc34411

Please sign in to comment.
Something went wrong with that request. Please try again.