Ruby Fundamentals Training Course

Public Classroom

Summary

ruby fundamentals

The Ruby Fundamentals training course provides a fast-track introduction to one of the most popular, cross-platform interpreted scripting languages – Ruby. The course utilizes a combination of theory and lab exercises to get the student comfortable with the programming language. The class covers the the basic functionality and APIs of Ruby, and how to use them together to create powerful applications. The course also gives you the information you need to use Ruby with various frameworks, such as Ruby on Rails. The course covers both the design considerations as well as the actual coding via a multitude of hands-on lab assignments.

Duration

2 days

Course Objectives

By the completion of the Ruby Fundamentals training course you should be able to:

  • Setup and configure Ruby development and execution environment
  • Understand Ruby object-oriented design, syntax, methods and assignment
  • Be comfortable working with Strings, Numbers and User Input
  • Create and instantiate Ruby classes; use the object-oriented paradigm to create Ruby programs
  • Understand Ruby Inheritance
  • Expertly use Ruby Arrays and Hashes and know when apply each
  • Be comfortable using Ruby conditionals (if/else), loops and iterators
  • Understand Ruby modules and utilize the built-in modules in your code
  • Write a simple Ruby application that utilizes the concepts learned in the class

Audience

This course is designed to be effective for beginners and intermediate level programmers. No prior experience using Ruby is assumed and basic concepts will be covered in sufficient detail to create a complete understanding. Knowledge of other programming languages besides Ruby is not a prerequisite for this course, but any experience writing code or scripting will certainly help you to understand and apply the concepts presented.

This course is ideal for:

  • Novice programmers who want to start developing in an object-oriented programming language
  • Existing developers looking to migrate from another language such as Java or Perl

Pre-requisites

This course assumes no previous experience with Ruby. Knowledge of another programming language and understanding fundamental concepts of Object Oriented Programming is a definite plus.

Outline

Introduction

  • What Is Ruby?
  • What Is Rails?

Installing Ruby Interpreter

  • Tool: irb Interactive Ruby

Running Ruby Programs in the command window

Ruby Language

  • Object Oriented Laguage
  • The Big Picture of Each Little Ruby Program
  • Syntax
  • Classes and Modules
  • Methods
  • Assignment
  • Variable Prefixes and Method Suffixes
  • Ruby’s Boolean Types
  • White-space

Aptana IDE – Integrated Development Environment

  • Workspace
  • Project
  • Import Files into Project
  • Edit a File and Run
  • Set Line Numbers
  • Set Fonts
  • Debugger
  • Shortcuts

User Input, Strings and Numbers

Classes and Instances

  • Main
  • Class Instance
  • Exercise – Class, Methods and User Input

Constructing Instances and Inspection

  • Classes and Objects and Inheritance
  • Encapsulation
  • Classes, Instances and Instance Variables
  • Constructors – new and initialize
  • Overriding the to_s method
  • Inspecting Objects
  • Exercise – Class, Methods, initialize instances and override to_s

Inheritance

  • Inheritance – Class Hierarchies
  • Exercise – Inheritance and Inspection

Variables and Accessors

  • Accessors, Attributes, Class Variables
  • Symbols in Ruby
  • Attribute Readers and Writers
  • Calling Methods of a Superclass
  • Class Variables
  • Exercise – attr_reader, attr_writer, attr_accessor and class variables

Arrays

  • One-Dimensional Arrays
  • Multi-Dimensional Arrays
  • Indexing into Arrays
  • Exercise – multi-dimentional array creation, assignment, inspection

Hashes

  • Hash
  • Indexing into a Hash
  • Hash Operations
  • Exercise – attr_reader, attr_writer, hash and class variables

Loops and Iterators

  • Overview
  • Blocks and Block Parameters
  • While Loops
  • More while Loops
  • Until Loops
  • Exercise – for, each() and while

Branching (Conditionals)

  • if..then..else
  • unless
  • case..when…else
  • Exercise – if…elseif…else

Modules and Mixins

  • Modules Versus Classes
  • Included Modules and Mixins
  • Local Variables in Modules
  • Included Modules from Files
  • Require Module
  • Standalone Module
  • Pre-Defined Modules
  • Exercise – File Required and Module Included

An Entire Application and Saving Data

  • YAML
  • Exercise – Write and Read to YAML format ‘Database’