Your SlideShare is downloading. ×
0
puts "Hello PTA!"
# Why Ruby?
whoami = {	
name: "Kenneth Kalmer",	
twitter: "@kennethkalmer",	
github: "kennethkalmer",	
blog: "opensourcery.co.za"	
}	
!
class History 	
def when? 	
1995 	
end 	
	
def where? 	
"Japan" 	
end 	
	
def by? 	
"Matz" 	
end 	
end 	
!
[1] pry(main)> class History
[1] pry(main)*
[1] pry(main)* def when?
[1] pry(main)* 1995
[1] pry(main)* end
[1] pry(main)*...
$ gem install pry
Fetching: pry-0.10.0.gem (100%)
Successfully installed pry-0.10.0
1 gem installed
!
$ pry
[1] pry(main)>...
$ pry
[1] pry(main)> 1.is_a?( Object ) && 1.is_a?( Fixnum )
=> true
!
[2] pry(main)> true.is_a?( Object ) && true.is_a?( T...
$ pry
[1] pry(main)> 1.object_id == 1.object_id
=> true
!
[2] pry(main)> "PTA".object_id == "PTA".object_id
=> false
$ pry
[1] pry(main)> require 'nokogiri'
=> true
!
[2] pry(main)> require 'open-uri'
=> true
!
[3] pry(main)> doc = Nokogir...
The Main Runtimes
The Interesting Runtimes
The Mobile Runtimes
required “reading”
http://mislav.uniqpath.com/poignant-guide/
3,239,798,210
downloads
of 77,207 gems cut since July 2009
require “*”
• State of the art dependency
management
• Authors now building the same tool for
the Rust programming language
require “sinatra”
get "/" do	
"<h1>Hello PTA</h1>"	
end	
• Rack
• Sinatra
• Padrino
• Rails
require “adhearsion”
class MyController < Adhearsion::CallController	
def run	
answer	
resp = ask "How many woodchucks?", ...
require “artoo”
connection :sphero, adaptor: :sphero, port: '4560'	
device :sphero, driver: :sphero	
!
work do	
every(3.se...
require “relevance”
Tools of the
trade
require “simple_form”
simple_form_for @user do |f|	
= f.input :email	
= f.input :password	
= f.submit "Login"	
• Rapid for...
require “better_errors”
require “reform”
class SongForm < Reform::Form	
property :title	
property :length	
!
validates :title, presence: true	
val...
require
“active_interaction”
• Model business processes as simple
objects.
• Avoid the callback hell that so easily
happen...
http://iwanttolearnruby.com/
trap("TERM") do	
puts "WIN"	
end	
!
exit
Why ruby
Why ruby
Why ruby
Why ruby
Why ruby
Why ruby
Why ruby
Upcoming SlideShare
Loading in...5
×

Why ruby

101

Published on

Slides for my Ruby landscape talk at Pretoria.rb - http://www.meetup.com/pretoria-rb/events/186593022

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
101
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Why ruby"

  1. 1. puts "Hello PTA!" # Why Ruby?
  2. 2. whoami = { name: "Kenneth Kalmer", twitter: "@kennethkalmer", github: "kennethkalmer", blog: "opensourcery.co.za" } !
  3. 3. class History def when? 1995 end def where? "Japan" end def by? "Matz" end end !
  4. 4. [1] pry(main)> class History [1] pry(main)* [1] pry(main)* def when? [1] pry(main)* 1995 [1] pry(main)* end [1] pry(main)* [1] pry(main)* def where? [1] pry(main)* "Japan" [1] pry(main)* end [1] pry(main)* [1] pry(main)* def by? [1] pry(main)* "Matz" [1] pry(main)* end [1] pry(main)* [1] pry(main)* end => :by? [2] pry(main)> lesson = History.new => #<History:0x007fcdb306a3f0> [3] pry(main)> lesson.when? => 1995 [4] pry(main)> lesson.where? => "Japan" [5] pry(main)> lesson.by? => "Matz"
  5. 5. $ gem install pry Fetching: pry-0.10.0.gem (100%) Successfully installed pry-0.10.0 1 gem installed ! $ pry [1] pry(main)> 1 + 1 => 2
  6. 6. $ pry [1] pry(main)> 1.is_a?( Object ) && 1.is_a?( Fixnum ) => true ! [2] pry(main)> true.is_a?( Object ) && true.is_a?( TrueClass ) => true ! [3] pry(main)> nil.is_a?( Object ) && nil.is_a?( NilClass ) => true ! [4] pry(main)> "PTA".is_a?( Object ) && "PTA".is_a?( String ) => true
  7. 7. $ pry [1] pry(main)> 1.object_id == 1.object_id => true ! [2] pry(main)> "PTA".object_id == "PTA".object_id => false
  8. 8. $ pry [1] pry(main)> require 'nokogiri' => true ! [2] pry(main)> require 'open-uri' => true ! [3] pry(main)> doc = Nokogiri::HTML(open("http://en.wikipedia.org/wiki/ Ruby_(programming_language)")) => #(Document:0x3fe11d253454…) ! [4] pry(main)> paragraph = doc.search('//*[@id="mw-content-text"]/p[23]').text => "Matsumoto has said that Ruby is designed for…” ! [5] pry(main)> paragraph =~ /"([^"]*)/ => 194 ! [6] pry(main)> $1 => "I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language."
  9. 9. The Main Runtimes
  10. 10. The Interesting Runtimes
  11. 11. The Mobile Runtimes
  12. 12. required “reading” http://mislav.uniqpath.com/poignant-guide/
  13. 13. 3,239,798,210 downloads of 77,207 gems cut since July 2009
  14. 14. require “*” • State of the art dependency management • Authors now building the same tool for the Rust programming language
  15. 15. require “sinatra” get "/" do "<h1>Hello PTA</h1>" end • Rack • Sinatra • Padrino • Rails
  16. 16. require “adhearsion” class MyController < Adhearsion::CallController def run answer resp = ask "How many woodchucks?", :limit => 1 say "You said #{resp}. That's obviously wrong!" end end ! # adhearsion.com
  17. 17. require “artoo” connection :sphero, adaptor: :sphero, port: '4560' device :sphero, driver: :sphero ! work do every(3.seconds) do puts "Rolling..." sphero.roll 60, rand(360) end end ! # artoo.io
  18. 18. require “relevance”
  19. 19. Tools of the trade
  20. 20. require “simple_form” simple_form_for @user do |f| = f.input :email = f.input :password = f.submit "Login" • Rapid form building • Highlight errors • Wrappers for Bootstrap
  21. 21. require “better_errors”
  22. 22. require “reform” class SongForm < Reform::Form property :title property :length ! validates :title, presence: true validates :length, numericality: true end ! class SongsController def new @form = SongForm.new(Song.new) end
  23. 23. require “active_interaction” • Model business processes as simple objects. • Avoid the callback hell that so easily happens in models
  24. 24. http://iwanttolearnruby.com/
  25. 25. trap("TERM") do puts "WIN" end ! exit
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×