Difference between revisions of "Ruby"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Advanced level)
 
(9 intermediate revisions by 3 users not shown)
Line 7: Line 7:
 
'''Ruby''' is also a great general purpose language. It can be used to write scripts and  can be also used to create full scale, standalone GUI based applications.It is also great for serving web pages, generating dynamic web page content and excels at database access tasks.  
 
'''Ruby''' is also a great general purpose language. It can be used to write scripts and  can be also used to create full scale, standalone GUI based applications.It is also great for serving web pages, generating dynamic web page content and excels at database access tasks.  
  
Being an interpreted language means that''' Ruby''' is''' portable'''. Once an application has been developed in Ruby it will run equally well on Ruby supported platforms such as '''Linux, UNIX, Windows and MacOS X.  
+
Being an interpreted language means that''' Ruby''' is''' portable'''. Once an application has been developed in Ruby it will run equally well on Ruby supported platforms such as '''Linux, UNIX, Windows and MacOS X. '''
'''
+
 
 +
'''Learners''': UG/PG CSE/IT/CS students to learn industry level programming.
 
__TOC__
 
__TOC__
  
Line 54: Line 55:
 
#**Declaring and Calling a method
 
#**Declaring and Calling a method
 
#*Passing arguments to a method
 
#*Passing arguments to a method
 +
#**Explaining the arguments and syntax with example.
 
#*Passing value to a method
 
#*Passing value to a method
 +
#**Explaining the syntax with example.
 
#*Returning value from a method
 
#*Returning value from a method
 +
#**Explaining the syntax with example
 
#Arithmetic & Relational Operators  in Ruby
 
#Arithmetic & Relational Operators  in Ruby
 
#*Arithmetic Operators
 
#*Arithmetic Operators
#** Demostrating arithemtic operators like +,-,/,%,* using irb
+
#**Addition
#*Operator Precedence
+
#**Subtraction
 +
#**Multiplication
 +
#**Division
 +
#**Modulus
 +
#**Exponent
 +
#*Precedence of operators
 
#*Relational Operators
 
#*Relational Operators
#**Demostrating arithemtic operators like ==,!=,<,>,<= ,>= using irb
+
#**Double equal to ==
 +
#**Not equal to !=
 +
#**Less than <
 +
#**Greater than >
 +
#**Less than or equal to >=
 +
#**Greater than or equal to >=
 +
#**Combined comparison <=>
 
#Logical & other operators  
 
#Logical & other operators  
 
#*Logical operator
 
#*Logical operator
#**Demostrating logical operators like and (&&),or(||),not(!) using irb
+
#**And &&
 +
#**Or ||
 +
#**Not !
 
#*Parallel assignment
 
#*Parallel assignment
 
#*Range operators
 
#*Range operators
Line 79: Line 96:
 
#*Syntax for case statement and example on it
 
#*Syntax for case statement and example on it
 
#*Comparison between if..elsif and case statement
 
#*Comparison between if..elsif and case statement
 +
 
==Intermediate level==   
 
==Intermediate level==   
#Looping Statements
+
#for and each Looping Statements
#*Loops
+
#*for & each loops in Ruby
#**Understanding the flow of loop
+
#*Meaning of the term “loop”
#*Syntax for
+
#*Different kinds of loop#**while loop
#**while loop
+
#*Syntax of “for” loop
#**until
+
#*Example implementation of “for” loop
#**unless
+
#*Syntax of “each” loop
#* Examples based on this loops
+
#*Example implementation of “each” loop
#Looping Methods
+
#*“for” and “each” loop implementation with inclusive and exclusive ranges
#*Syntax for
+
#while and until Looping Statements
#**for loop
+
#*while & until loops in Ruby
#**times method
+
#*Usage of while loop with an example
#**upto method
+
#*Usage of until loop with an example
#**downto method
+
#*Usage of redo construct with an example
#*Examples based on the above methods
+
#*Usage of break with an example
#Creating Strings in Ruby
+
#Object Oriented Concept in Ruby
#*What is string
+
#*Object Oriented Concept in Ruby
#**Learning to create and manipulate the strings
+
#*Classes in Ruby
#*Performing operation on string like
+
#*How to create objects
#**String length
+
#*Different ways of defining methods in Ruby
#**String concatenation
+
#**Using ? and = to define meaningful methods
#**String Comparison
+
#*Example implementation of each of the above
#**String Replacement & substitution
+
#Object Oriented Programming Methods
#**String conversion to
+
#*Methods in Ruby
#***Array
+
#*What are
#***Uppercase
+
#**instance methods
#***Other object type
+
#**class methods
#Collections in Ruby
+
#**accessor methods
#*Array
+
#*Example implementation of each of the above
#**What is an array
+
#*Difference between them
#**Creating a new  array
+
#**Iterating the array using each loop
+
#**Operation on array like sorting, reversing
+
#*Hashes
+
#**What is hash
+
#**Difference between hash and array
+
#**Creating and accessing the hash
+
#
+

Latest revision as of 12:44, 11 October 2021

Introduction to Ruby

Ruby has been described as an absolutely pure object-oriented scripting language and a genuine attempt to combine the best of everything in the scripting world.Its creator, Yukihiro “matz” Matsumoto, blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language that balanced functional programming with imperative programming.Ruby is written in C, and it was designed with Perl and Python capabilities in mind.

Ruby supports multiple programming paradigms including functional, object oriented, imperative and reflective. It also has a dynamic type system and automatic memory management.It's consistency and it's object model make it easy to use. The syntax is simple, clean, and readable, with an expressiveness that gives your code a natural flow.

Ruby is also a great general purpose language. It can be used to write scripts and can be also used to create full scale, standalone GUI based applications.It is also great for serving web pages, generating dynamic web page content and excels at database access tasks.

Being an interpreted language means that Ruby is portable. Once an application has been developed in Ruby it will run equally well on Ruby supported platforms such as Linux, UNIX, Windows and MacOS X.

Learners: UG/PG CSE/IT/CS students to learn industry level programming.

Basic Level

  1. Hello Ruby
    • Introduction to Ruby
      • What is Ruby?
      • Features
      • Ruby gems
      • Help on ruby
    • Installation
      • Installation of ruby 1.9 through Ubuntu Software Centre
      • Other methods to install ruby
        • Rvm (ruby version manager)
        • Rbenv
    • Running ruby code
      • Three ways to execute ruby code
        • Interactive ruby
        • As a file
        • From commandline
      • Example :Hello World
    • Commenting in Ruby
      • How to add comments
        • single line comments
        • multiple line or block comments
    • Difference between Puts and Print in ruby
      • Explaining the difference by using example
  2. Variables in Ruby
    • Introduction
      • Ruby and variable Dynamic typing
      • Declaring a variable
      • Changing variable type
      • Converting the var value i.e to float,string,binary etc
    • Scope of Variables
      • What is variable scope
      • Types of variables
        • Global variable
        • local variable
        • class variable
        • instance variable
        • constant variable
  3. Ruby Methods
    • What is method
      • Working with methods
      • Declaring and Calling a method
    • Passing arguments to a method
      • Explaining the arguments and syntax with example.
    • Passing value to a method
      • Explaining the syntax with example.
    • Returning value from a method
      • Explaining the syntax with example
  4. Arithmetic & Relational Operators in Ruby
    • Arithmetic Operators
      • Addition
      • Subtraction
      • Multiplication
      • Division
      • Modulus
      • Exponent
    • Precedence of operators
    • Relational Operators
      • Double equal to ==
      • Not equal to !=
      • Less than <
      • Greater than >
      • Less than or equal to >=
      • Greater than or equal to >=
      • Combined comparison <=>
  5. Logical & other operators
    • Logical operator
      • And &&
      • Or ||
      • Not !
    • Parallel assignment
    • Range operators
      • Inclusive Operator(..)
      • Exclusive operator (...)
  6. Control Statements in Ruby
    • What are control statements
    • Syntax for
      • if statement
      • if..else statement
      • if..elsif statement
      • Examples on it
    • Ternary Operator
    • Syntax for case statement and example on it
    • Comparison between if..elsif and case statement

Intermediate level

  1. for and each Looping Statements
    • for & each loops in Ruby
    • Meaning of the term “loop”
    • Different kinds of loop#**while loop
    • Syntax of “for” loop
    • Example implementation of “for” loop
    • Syntax of “each” loop
    • Example implementation of “each” loop
    • “for” and “each” loop implementation with inclusive and exclusive ranges
  2. while and until Looping Statements
    • while & until loops in Ruby
    • Usage of while loop with an example
    • Usage of until loop with an example
    • Usage of redo construct with an example
    • Usage of break with an example
  3. Object Oriented Concept in Ruby
    • Object Oriented Concept in Ruby
    • Classes in Ruby
    • How to create objects
    • Different ways of defining methods in Ruby
      • Using ? and = to define meaningful methods
    • Example implementation of each of the above
  4. Object Oriented Programming Methods
    • Methods in Ruby
    • What are
      • instance methods
      • class methods
      • accessor methods
    • Example implementation of each of the above
    • Difference between them

Contributors and Content Editors

Afrin, PoojaMoolya, Pratham920