SlideShare a Scribd company logo
Ruby
Week 2
Agenda
Homework Review and Submission

Git Branches

The Ruby Language

Ruby Gems (grb)

IRB: String objects, String Class,
Variables, puts/gets

Making Our Own Objects
HomeWork Review


Questions.txt

strings_and_rspec_spec.rb

Send a Pull Request to UWE-Ruby/
RubyFall2012
Git Review


GitHub

forks and repos (remote & local)

branches (DeMo!)
Rspec Review


Code that Tests Code!!

Describe a feature, set an
expectation.

Red-Green-Refactor
Ruby

Everything is an Object!

Type Doesn’t matter! (respond_to?)

Speaking Ruby : Interpreter Needed!

  MRI, YARV, JRuby
Ruby Gems

Packaged Ruby Code

Open Source

iPhone user:   “There’s an app for that!”


Ruby programer:    “There’s a gem for that!”
GRB

Git Remote Branch

Ruby Gem to help with git!

Combines remote branch steps into
one!

DeMo!
IRB

Interactive Ruby!

Our Ruby Interpreter!

We speak ruby, it translates!

Understand Ruby code, evaluates it,
gives us the result (inspect)
Ruby

Everything evaluates to something

nil is NULL or nothing or Not Set

Every Object respond_to? inspect

  => true
Objects

Ruby: everything is an object

  Everything is an instance of a
  class

Ruby knows about certain classes of
things: Standard Library
String

String class : part of the standard
library

How Ruby understands text

Instances

  String.new or ‘’ or “”    or Q%[] or
  q%[]
String Class

http://www.ruby-doc.org/core-1.9.3/
String.html

Methods : Messages we can send, what
an instance will respond to

Chomp, *, +, include?, upcase
Variables


Named location

Points to something

Contents Can Change
String Interpolation



 my_name = “Renée”

 “Hello #{my_name}”
puts / gets

put string

get string

puts “Hello World”

user_input = gets

user_input = gets.chomp
Mad-Libs!

noun = gets.chomp

adjective = gets.chomp

verb_past_tense = gets.chomp

“The #{adjective} #{noun}
#{verb_past_tense} past the
graveyard”
Ruby Scripts



mad_libs.rb

ruby mad_libs.rb
Making Objects



Tell Ruby About Something New!

A new class of stuff!
What is a Book



All Books have....??
Defining New Classes

 Initialize

 attributes / readers and writers

 Scope

   Instance variables

   Instance methods
Homework



Reading and Simon Says Spec

More Related Content

PDF
Ruby Presentation - Beamer
PDF
Ruby Presentation
PDF
JavaScript Essentials for Ember development
PPTX
Ruby Programming Language - Introduction
PPTX
Kotlin L → ∞
PPTX
Ruby programming
PDF
Mobile Software Engineering Crash Course - C02 Java Primer
PDF
Introduction to Ruby
Ruby Presentation - Beamer
Ruby Presentation
JavaScript Essentials for Ember development
Ruby Programming Language - Introduction
Kotlin L → ∞
Ruby programming
Mobile Software Engineering Crash Course - C02 Java Primer
Introduction to Ruby

What's hot (20)

KEY
Introduction to Ruby
PDF
TypeProf for IDE: Enrich Development Experience without Annotations
PDF
A Type-level Ruby Interpreter for Testing and Understanding
PDF
Bldr: A Minimalist JSON Templating DSL
PDF
Enjoy Ruby Programming in IDE and TypeProf
PDF
A Test Code Generator for RSpec Users
PDF
Iron* - An Introduction to Getting Dynamic on .NET
PDF
OOPS Advanced
ODP
Getting started with typescript and angular 2
PDF
Type Profiler: An Analysis to guess type signatures
PDF
Type Profiler: Ambitious Type Inference for Ruby 3
KEY
The Ruby Racer: under the hood
PDF
A Plan towards Ruby 3 Types
PPTX
Ruby introductions
PPTX
Dynamic Language Performance
PDF
Continuations in scala (incomplete version)
PDF
Advanced Reflection in Pharo
PPTX
Actor-based concurrency and Akka Fundamentals
PDF
Scala the-good-parts
PPTX
Groovy / comparison with java
Introduction to Ruby
TypeProf for IDE: Enrich Development Experience without Annotations
A Type-level Ruby Interpreter for Testing and Understanding
Bldr: A Minimalist JSON Templating DSL
Enjoy Ruby Programming in IDE and TypeProf
A Test Code Generator for RSpec Users
Iron* - An Introduction to Getting Dynamic on .NET
OOPS Advanced
Getting started with typescript and angular 2
Type Profiler: An Analysis to guess type signatures
Type Profiler: Ambitious Type Inference for Ruby 3
The Ruby Racer: under the hood
A Plan towards Ruby 3 Types
Ruby introductions
Dynamic Language Performance
Continuations in scala (incomplete version)
Advanced Reflection in Pharo
Actor-based concurrency and Akka Fundamentals
Scala the-good-parts
Groovy / comparison with java
Ad

Similar to Week2 (20)

PPT
Workin ontherailsroad
PPT
WorkinOnTheRailsRoad
ZIP
Meta Programming in Ruby - Code Camp 2010
PPT
Intro To Ror
PDF
How DSL works on Ruby
PDF
Ruby an overall approach
KEY
Ruby on Rails Training - Module 1
PDF
Ruby tutorial
DOCX
Page List & Sample Material (Repaired)
PDF
Gemification for Ruby 2.5/3.0
KEY
Learn Ruby 2011 - Session 1
PDF
Ruby Metaprogramming 08
PDF
2016-05-12 DCRUG React.rb
PDF
Ruby Metaprogramming - OSCON 2008
PPTX
sl-unit2 ppt for cse in b.tech jntuh iii year
PPTX
On the path to become a jr. developer short version
PDF
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
PPT
Rubyon Rails
PDF
ruby_vs_perl_and_python
PDF
ruby_vs_perl_and_python
Workin ontherailsroad
WorkinOnTheRailsRoad
Meta Programming in Ruby - Code Camp 2010
Intro To Ror
How DSL works on Ruby
Ruby an overall approach
Ruby on Rails Training - Module 1
Ruby tutorial
Page List & Sample Material (Repaired)
Gemification for Ruby 2.5/3.0
Learn Ruby 2011 - Session 1
Ruby Metaprogramming 08
2016-05-12 DCRUG React.rb
Ruby Metaprogramming - OSCON 2008
sl-unit2 ppt for cse in b.tech jntuh iii year
On the path to become a jr. developer short version
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Rubyon Rails
ruby_vs_perl_and_python
ruby_vs_perl_and_python
Ad

More from reneedv (14)

PDF
Nginx caching
PPT
Week10
PPT
Week9
KEY
Week7
KEY
Week6
KEY
Week5
KEY
Week4
KEY
Week3
KEY
Week1
KEY
Fill Up your Bookshelves!
ODP
Dealing with Legacy <del>Code</del> People
ODP
Whose Wife Are You?
PPTX
How I Learned to Smell Code
PPTX
RailsBrdige Seattle Workshop Intro
Nginx caching
Week10
Week9
Week7
Week6
Week5
Week4
Week3
Week1
Fill Up your Bookshelves!
Dealing with Legacy <del>Code</del> People
Whose Wife Are You?
How I Learned to Smell Code
RailsBrdige Seattle Workshop Intro

Week2

Editor's Notes