Your SlideShare is downloading. ×
Reasons To Love Ruby
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Reasons To Love Ruby

1,430
views

Published on

A general introduction to the Ruby language and ecosystem from a .NET Developer's perspective.

A general introduction to the Ruby language and ecosystem from a .NET Developer's perspective.

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,430
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. a bunch of reasons to love ruby
  • 2. class Ben < Personis_a :mvp, :scrummaster, :aspinsider def initialize @book = “ASP.NET MVC in Action” @twitter = “subdigital” @blog= “http://flux88.com” @iphone_app= “Pocket Tabs” end ...end
  • 3. def self.expert? falseend
  • 4. Meet Ruby
    puts“hello world”hello world
    puts“hello world”.reversedlrowolleh
    puts“hello world”[0..5] hello
  • 5. Ruby Variables
    num = 323
    message = “Hey there”
    stuff = [1, “foo”, true]
  • 6. Ruby Loops
    [“cat”, “dog”, “giraffe”].each do |s|
    puts s
    end
    [“cat”, “dog”, “giraffe”].each { |s| puts s }
  • 7. Working with Arrays
    animals = [“zebra”, “donkey”, “lemur”]
    animals.sort[“donkey”, “lemur”, “zebra”]
    # original array is untouched
    animals.sort!
    # original array is modified!
    animals.delete“zebra” [“donkey”, “lemur”]
  • 8. Ruby has Less Ceremony
    //C#
    Dictionary<string, object> hash = new Dictionary<string, object>();
    #ruby
    hash = {}
    #optional semicolons & parentheses
    add(5, 6); is the same as add 5, 6
  • 9. You Can Extend Existing classes
    5.days.from_now
  • 10. Ruby is Terse, yet Readable
    3.times { print “Ho ” } => Ho Ho Ho
    approve_credit unless account.deliquent?
    send_email if email_enabled?
  • 11. Regex is a 1st class citizen
    [“red”, “blue”, “green”].grep /u/ blue
    “The Times They are a-Changin’”.gsub /s/, “.”
    The.Times.They.are.a-Changin’
  • 12. Everything is an Object
    42.class FixNum
    42.2.class.superclass  Integer
    42.class.superclass.superclass  Numeric
    42.class.superclass.superclass.superclass  Object
    No, really… everything is an object
    puts customer.name unless customer.nil?
    nil.classNilClass
    nil.class.superclass Object
  • 13. RubyGems
    gem installhpricot
  • 14. Speaking of hpricot…
    require ‘rubygems’
    require ‘hpricot’
    require ‘open-uri’
    uri = open(“http://whatsit.org”)
    doc = Hpricot(uri)
    (doc/"p/a/img").each do |img|
    puts img.attributes['class']
    end
  • 15. Rake
    task :codeGen do
    # do the code generation
    end
    task :compile => :codeGen do
    #do the compilation
    end
    task :dataLoad => :codeGen do
    # load the test data
    end
    task :test => [:compile, :dataLoad] do
    # run the tests
    end
  • 16. RSpec
    # bowling_spec.rb
    require 'bowling'
    describe Bowling do
    it "should score 0 for gutter game" do
    bowling = Bowling.new
    20.times { bowling.hit 0 }
    bowling.score.should == 0
    end
    end
  • 17. …and now the elephant in the room
    rails
  • 18. Rails is the bee’s knees because…
    convention
    configuration
  • 19. Rails is the bee’s knees because…
    it has
    ActiveRecord
  • 20. Rails is the bee’s knees because…
    it has
    Migrations
  • 21. Rails is the bee’s knees because…
    it has the
    Console
  • 22. Rails is the bee’s knees because…
    scaffolding
  • 23. Rails is the bee’s knees because…
    Logging is built-in
  • 24. Rails is the bee’s knees because…
    Tests come out of the box
  • 25. Rails is the bee’s knees because…
    There is ONE WAY
  • 26. What else?
    heroku
  • 27. What else?
    IronRuby
  • 28. thank_you