Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

polishing off

  • Loading branch information...
commit 7a976c25832d1ec3e10be747120f8b07b084e865 1 parent 3733a65
@adamhunter authored
Showing with 95 additions and 33 deletions.
  1. +95 −33 slides.rb
View
128 slides.rb
@@ -3,6 +3,8 @@
blink_end = "\e[m\n"
SLIDES = [
+ clear_screen +
+ "Welcome to Ruby 101! ".to_ascii.colorize(background: :blue),
clear_screen +
"Why is Ruby Awesome?".to_ascii.red,
@@ -317,39 +319,99 @@ def gender
@gender.to_s.upcase.first
end
end
- ]
-
- # clear_screen +
- # "Class.methods".to_ascii.colorize(color: :black, background: :yellow),
-
- # clear_screen +
- # "Mo Modules mo problems".to_ascii.light_green,
- # Patching the monkey
-
- # clear_screen +
- # "Protoype Methods".to_ascii,
-
- # clear_screen +
- # "Ruby Gems".to_ascii.red,
-
- # clear_screen +
- # "Bundler".to_ascii.light_blue,
-
- # clear_screen +
- # "Rspec".to_ascii.green,
- # %Q[
- # describe "mommas" do
- # it "is so fat" do
- # # expects yo_momma.so_fat? to return true
- # yo_momma.should be_so_fat
- # end
- # end
-
- # # NOTE!
- # # Rspec now lets you write yo momma jokes this way:
- # # expect(yo_momma).to be_so_fat
- # ]
-
+ ],
+
+ clear_screen +
+ "Class.methods".to_ascii.colorize(color: :black, background: :yellow),
+ %Q[
+ class Person
+ def self.new_with_name(name)
+ new name: name
+ end
+ end
+
+ def Person.new_with_name_and_age(name, age)
+ new name: name, age: age
+ end
+ ],
+
+ clear_screen +
+ "Mo Modules mo problems".to_ascii.light_green,
+ %q[
+ module Vocal
+ def speak(attribute)
+ def "My #{attribute} is #{public_send(attribute)}"
+ end
+ end
+
+ class Person
+ include Vocal
+ end
+
+ module Explosive
+ def explode
+ puts split('').map { |c| c.rjust(rand(50) + 1, ' ') }.join("\n")
+ end
+ end
+
+ String.send(:include, Explosive)
+ ],
+
+ clear_screen +
+ "Protoype Methods".to_ascii,
+ %Q[
+ Examples:
+
+ person = Person.new
+
+ def person.awesome?
+ name == 'Adam'
+ end
+
+ person.awesome?
+ person.name = 'Adam'
+ person.awesome?
+
+ ben = person.clone
+ jim = person.dup
+ ben.name = 'Ben'
+ jim.name = 'Jim'
+
+ ben.awesome?
+ jim.awesome?
+ ],
+
+ clear_screen +
+ "Ruby Gems".to_ascii.red,
+ %Q[
+ gem install colorize
+ irb
+ require 'colorize'
+ puts "Ruby Gems makes ruby awesome".red
+ ],
+
+ clear_screen +
+ "Bundler".to_ascii.light_blue,
+ clear_screen +
+ "Rspec".to_ascii.green,
+ %Q[
+ # NOTE! in a new tab, I can run `rspec main.rb` to run all my specs
+
+ describe "mommas" do
+ it "is so fat" do
+ # expects yo_momma.so_fat? to return true
+ yo_momma.should be_so_fat
+ end
+ end
+
+ # NOTE!
+ # Rspec now lets you write yo momma jokes this way:
+ # expect(yo_momma).to be_so_fat
+ ],
+
+ clear_screen +
+ "Thank you! ".to_ascii.colorize(background: :red)
+
].freeze
Please sign in to comment.
Something went wrong with that request. Please try again.