SlideShare une entreprise Scribd logo
1  sur  58
Ruby for C# Developers Cory Foy http://www.cornetdesign.com St. Louis Code Camp May 6 th , 2006
Overview ,[object Object],[object Object],[object Object],[object Object],[object Object]
What is Ruby? ,[object Object],[object Object],[object Object],[object Object],[object Object]
What is Ruby? ,[object Object],class Person attr_accessor :name, :age  # attributes we can set and retrieve def initialize(name, age)  # constructor method @name = name  # store name and age for later retrieval @age  = age.to_i    # (store age as integer) end def inspect  # This method retrieves saved values "#@name (#@age)"  # in a readable format end end p1 = Person.new('elmo', 4)  # elmo is the name, 4 is the age puts p1.inspect  # prints “elmo (4)”
Will It Change Your Life? ,[object Object],[object Object],[object Object],[object Object]
Ruby Basics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby Basics - Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby Basics - Classes ,[object Object],class Move attr_accessor :up, :right def initialize(up, right) @up = up @right = right end end
Ruby Basics - Classes ,[object Object],class Move attr_accessor :up, :right def initialize(up, right) @up = up @right = right end end
Ruby Basics - Classes ,[object Object],class Move attr_accessor :up, :right def initialize(up, right) @up = up @right = right end end
Ruby Basics - Methods ,[object Object],class Move def up @up end def right return @right end end
Ruby Basics - Methods ,[object Object],class Move def initialize(up, right) @up = up @right = right end end
Ruby Basics - Methods ,[object Object],class Move def self.create return Move.new end def Move.logger return @@logger end end
Ruby Basics - Properties ,[object Object],class Move def up @up end end class Move def up=(val) @up = val end end move = Move.new move.up = 15 puts move.up  #15
Ruby Basics - Properties ,[object Object],class Move attr_accessor :up  #Same thing as last slide end move = Move.new move.up = 15 puts move.up  #15
Ruby Basics - Properties ,[object Object],class Move attr_reader :up  #Can’t write attr_writer :down #Can’t read end move = Move.new move.up = 15  #error d = move.down  #error
Ruby Basics - Exceptions ,[object Object],[object Object],[object Object]
Ruby Basics - Exceptions process_file = File.open(“testfile.csv”) begin  #put exceptional code in begin/end block #...process file rescue IOError => io_error puts “IOException occurred. Retrying.” retry  #starts block over from begin rescue => other_error puts “Bad stuff happened: “ + other_error else  #happens if no exceptions occur puts “No errors in processing. Yippee!” ensure  # similar to finally in .NET/Java process_file.close unless process_file.nil? end
Ruby Basics – Access Control ,[object Object],[object Object]
Ruby Basics – Access Control ,[object Object],class Move private def calculate_move end #Any subsequent methods will be private until.. public def show_move end #Any subsequent methods will now be public end
Ruby Basics – Access Control ,[object Object],class Move def calculate_move end def show_move end public :show_move protected :calculate_move end
Ruby Basics - Imports ,[object Object],require ‘calculator’ class Move def calculate_move return @up * Calculator::MIN_MOVE end end
Ruby Basics - Imports ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby Basics – Duck Typing ,[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby Basics – Duck Typing ,[object Object],[object Object],class CarWash def accept_customer(car) end end ,[object Object]
Ruby Basics – Duck Typing ,[object Object]
Ruby Basics – Duck Typing ,[object Object]
Ruby Basics – Duck Typing ,[object Object]
Ruby Basics – Duck Typing ,[object Object],[object Object]
Ruby Basics – Duck Typing ,[object Object],Class CarWash def accept_customer(car) if car.respond_to?(:drive_to) @car = car wash_car else reject_customer end end end
Ruby Basics – Unit Tests ,[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby Basics – Unit Tests ,[object Object],[object Object],[object Object]
Ruby Basics – Unit Tests ,[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby Basics – Unit Tests ,[object Object],[object Object],[object Object],[object Object]
Ruby Basics – Unit Tests ,[object Object],class TestToaster < Test::Unit::TestCase def test_toast_bread toaster = Toaster.new bread = WonderBread.new toaster.heat_level = 5 toaster.toast(bread) assert_equal(“Nicely toasted”, bread.status) end end
Ruby Basics – Unit Tests ,[object Object],root@dilbert $ruby testtoaster.rb Loaded suite testtoaster Started E Finished in 0.0 seconds. 1) Error: test_toast_bread(TestToaster): NameError: uninitialized constant TestToaster::Toaster testtoaster.rb:4:in `test_toast_bread' 1 tests, 0 assertions, 0 failures, 1 errors
Ruby Basics – Unit Tests ,[object Object],class Toaster attr_accessor :heat_level def toast(bread) end end class WonderBread  attr_accessor :status end
Ruby Basics – Unit Tests ,[object Object],root@dilbert $ruby testtoaster.rb Loaded suite testtoaster Started F Finished in 0.093 seconds. 1) Failure: test_toast_bread(TestToaster) [testtoaster.rb:10]: <&quot;Nicely toasted&quot;> expected but was <nil>. 1 tests, 1 assertions, 1 failures, 0 errors
Ruby Basics – Unit Tests ,[object Object],class Toaster def toast(bread) bread.status = “Nicely toasted” end end root@dilbert $ruby testtoaster.rb Loaded suite testtoaster Started . Finished in 0.0 seconds. 1 tests, 1 assertions, 0 failures, 0 errors
Ruby Basics – Unit Tests ,[object Object],[object Object]
Ruby Basics – Unit Tests ,[object Object],[object Object],[object Object],[object Object],[object Object]
Advanced Ruby - Modules ,[object Object],[object Object],[object Object],[object Object],[object Object]
Advanced Ruby - Blocks ,[object Object],{ puts “Ho” } 3.times do puts “Ho “ end  #prints “Ho Ho Ho”
Advanced Ruby - Blocks ,[object Object],def format_print puts “Confidential. Do Not Disseminate.” yield puts “© SomeCorp, 2006” end format_print { puts “My name is Earl!” } -> Confidential. Do Not Disseminate. -> My name is Earl! -> © SomeCorp, 2006
Advanced Ruby - Blocks ,[object Object],def MyConnection.open(*args) conn = Connection.open(*args) if block_given? yield conn  #passes conn to the block conn.close  #closes conn when block finishes end return conn end
Advanced Ruby - Iterators ,[object Object],[object Object]
Advanced Ruby - Iterators ,[object Object],def fib_up_to(max) i1, i2 = 1, 1 while i1 <= max yield i1 i1, i2 = i2, i1+i2 # parallel assignment end end fib_up_to(100) {|f| print f + “ “} -> 1 1 2 3 5 8 13 21 34 55 89
Advanced Ruby - Modules ,[object Object],module Kite def Kite.fly end end module Plane def Plane.fly end end
Advanced Ruby - Mixins ,[object Object],[object Object],[object Object]
Advanced Ruby - Mixins module Print def print puts “Company Confidential” yield end end class Document include Print #... end doc = Document.new doc.print { “Fourth Quarter looks great!” } -> Company Confidential -> Fourth Quarter looks great!
Advanced Ruby - Reflection ,[object Object],String myString = &quot;test&quot;; int len =  (int)myString .GetType() .InvokeMember(&quot;Length&quot;, System.Reflection.BindingFlags.GetProperty,  null, myString, null); Console.WriteLine(&quot;Length: &quot; + len.ToString());
Advanced Ruby - Reflection ,[object Object],myString = “Test” puts myString.send(:length)  # 4
Advanced Ruby - Reflection ,[object Object],#print out all of the objects in our system ObjectSpace.each_object(Class) {|c| puts c} #Get all the methods on an object “ Some String”.methods #see if an object responds to a certain method obj.respond_to?(:length) #see if an object is a type obj.kind_of?(Numeric) obj.instance_of?(FixNum)
Ruby Basics – Other Goodies ,[object Object],[object Object],[object Object]
Ruby and .NET ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby and .NET ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby and .NET ,[object Object],[object Object],[object Object],[object Object],[object Object]
Ruby Resources ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Contenu connexe

Tendances

JavaScript - Programming Languages course
JavaScript - Programming Languages course JavaScript - Programming Languages course
JavaScript - Programming Languages course yoavrubin
 
The Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumThe Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumMatthias Noback
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript ProgrammingSehwan Noh
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyNick Sieger
 
Introduction to Kotlin for Android developers
Introduction to Kotlin for Android developersIntroduction to Kotlin for Android developers
Introduction to Kotlin for Android developersMohamed Wael
 
Coding Best Practices
Coding Best PracticesCoding Best Practices
Coding Best Practicesmh_azad
 
JavaScript - From Birth To Closure
JavaScript - From Birth To ClosureJavaScript - From Birth To Closure
JavaScript - From Birth To ClosureRobert Nyman
 
Mobile Software Engineering Crash Course - C02 Java Primer
Mobile Software Engineering Crash Course - C02 Java PrimerMobile Software Engineering Crash Course - C02 Java Primer
Mobile Software Engineering Crash Course - C02 Java PrimerMohammad Shaker
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming LanguageRaghavan Mohan
 
The Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaThe Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaMatthias Noback
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...Edureka!
 
BDD style Unit Testing
BDD style Unit TestingBDD style Unit Testing
BDD style Unit TestingWen-Tien Chang
 
Learning puppet chapter 2
Learning puppet chapter 2Learning puppet chapter 2
Learning puppet chapter 2Vishal Biyani
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projectsjazzman1980
 

Tendances (20)

JavaScript - Programming Languages course
JavaScript - Programming Languages course JavaScript - Programming Languages course
JavaScript - Programming Languages course
 
Javascript
JavascriptJavascript
Javascript
 
Java8 features
Java8 featuresJava8 features
Java8 features
 
Rjb
RjbRjb
Rjb
 
The Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumThe Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup Belgium
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
Introduction to Kotlin for Android developers
Introduction to Kotlin for Android developersIntroduction to Kotlin for Android developers
Introduction to Kotlin for Android developers
 
Coding Best Practices
Coding Best PracticesCoding Best Practices
Coding Best Practices
 
JavaScript - From Birth To Closure
JavaScript - From Birth To ClosureJavaScript - From Birth To Closure
JavaScript - From Birth To Closure
 
Mobile Software Engineering Crash Course - C02 Java Primer
Mobile Software Engineering Crash Course - C02 Java PrimerMobile Software Engineering Crash Course - C02 Java Primer
Mobile Software Engineering Crash Course - C02 Java Primer
 
Groovy Programming Language
Groovy Programming LanguageGroovy Programming Language
Groovy Programming Language
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
Virtual Function
Virtual FunctionVirtual Function
Virtual Function
 
The Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaThe Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony Barcelona
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
 
BDD style Unit Testing
BDD style Unit TestingBDD style Unit Testing
BDD style Unit Testing
 
Constructors and destructors in C++ part 2
Constructors and destructors in C++ part 2Constructors and destructors in C++ part 2
Constructors and destructors in C++ part 2
 
Learning puppet chapter 2
Learning puppet chapter 2Learning puppet chapter 2
Learning puppet chapter 2
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projects
 

En vedette

When Code Cries
When Code CriesWhen Code Cries
When Code CriesCory Foy
 
Delivering What's Right
Delivering What's RightDelivering What's Right
Delivering What's RightCory Foy
 
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy CodeMud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy CodeCory Foy
 
Nanoshel Presentation
Nanoshel PresentationNanoshel Presentation
Nanoshel PresentationNanoshel
 
Fostering Software Craftsmanship
Fostering Software CraftsmanshipFostering Software Craftsmanship
Fostering Software CraftsmanshipCory Foy
 
Konica Minolta Corporate Profile 2012
Konica Minolta Corporate Profile 2012Konica Minolta Corporate Profile 2012
Konica Minolta Corporate Profile 2012Konica Minolta
 
Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?Cory Foy
 
GOTO Berlin - When Code Cries
GOTO Berlin - When Code CriesGOTO Berlin - When Code Cries
GOTO Berlin - When Code CriesCory Foy
 
Koans and Katas, Oh My! From Øredev 2010
Koans and Katas, Oh My! From Øredev 2010Koans and Katas, Oh My! From Øredev 2010
Koans and Katas, Oh My! From Øredev 2010Cory Foy
 

En vedette (9)

When Code Cries
When Code CriesWhen Code Cries
When Code Cries
 
Delivering What's Right
Delivering What's RightDelivering What's Right
Delivering What's Right
 
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy CodeMud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
 
Nanoshel Presentation
Nanoshel PresentationNanoshel Presentation
Nanoshel Presentation
 
Fostering Software Craftsmanship
Fostering Software CraftsmanshipFostering Software Craftsmanship
Fostering Software Craftsmanship
 
Konica Minolta Corporate Profile 2012
Konica Minolta Corporate Profile 2012Konica Minolta Corporate Profile 2012
Konica Minolta Corporate Profile 2012
 
Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?
 
GOTO Berlin - When Code Cries
GOTO Berlin - When Code CriesGOTO Berlin - When Code Cries
GOTO Berlin - When Code Cries
 
Koans and Katas, Oh My! From Øredev 2010
Koans and Katas, Oh My! From Øredev 2010Koans and Katas, Oh My! From Øredev 2010
Koans and Katas, Oh My! From Øredev 2010
 

Similaire à Ruby for C# Developers

A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends旻琦 潘
 
Ruby — An introduction
Ruby — An introductionRuby — An introduction
Ruby — An introductionGonçalo Silva
 
How To Test Everything
How To Test EverythingHow To Test Everything
How To Test Everythingnoelrap
 
Testing With Test::Class
Testing With Test::ClassTesting With Test::Class
Testing With Test::ClassCurtis Poe
 
JavaScript Cheatsheets with easy way .pdf
JavaScript Cheatsheets with easy way .pdfJavaScript Cheatsheets with easy way .pdf
JavaScript Cheatsheets with easy way .pdfranjanadeore1
 
1669958779195.pdf
1669958779195.pdf1669958779195.pdf
1669958779195.pdfvenud11
 
Ruby/Rails
Ruby/RailsRuby/Rails
Ruby/Railsrstankov
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9sagaroceanic11
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9sagaroceanic11
 
Ruby: Beyond the Basics
Ruby: Beyond the BasicsRuby: Beyond the Basics
Ruby: Beyond the BasicsMichael Koby
 
What's new in Ruby 2.0
What's new in Ruby 2.0What's new in Ruby 2.0
What's new in Ruby 2.0Kartik Sahoo
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation platico_dev
 
Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technologyppparthpatel123
 
How to discover the Ruby's defects with web application
How to discover the Ruby's defects with web applicationHow to discover the Ruby's defects with web application
How to discover the Ruby's defects with web applicationHiroshi SHIBATA
 
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Bruce Li
 

Similaire à Ruby for C# Developers (20)

Ruby
RubyRuby
Ruby
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
 
Ruby basics
Ruby basicsRuby basics
Ruby basics
 
Ruby — An introduction
Ruby — An introductionRuby — An introduction
Ruby — An introduction
 
How To Test Everything
How To Test EverythingHow To Test Everything
How To Test Everything
 
Testing With Test::Class
Testing With Test::ClassTesting With Test::Class
Testing With Test::Class
 
JavaScript Cheatsheets with easy way .pdf
JavaScript Cheatsheets with easy way .pdfJavaScript Cheatsheets with easy way .pdf
JavaScript Cheatsheets with easy way .pdf
 
1669958779195.pdf
1669958779195.pdf1669958779195.pdf
1669958779195.pdf
 
Ruby/Rails
Ruby/RailsRuby/Rails
Ruby/Rails
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
 
Ruby: Beyond the Basics
Ruby: Beyond the BasicsRuby: Beyond the Basics
Ruby: Beyond the Basics
 
What's new in Ruby 2.0
What's new in Ruby 2.0What's new in Ruby 2.0
What's new in Ruby 2.0
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation
 
Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technology
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
Java For Automation
Java   For AutomationJava   For Automation
Java For Automation
 
How to discover the Ruby's defects with web application
How to discover the Ruby's defects with web applicationHow to discover the Ruby's defects with web application
How to discover the Ruby's defects with web application
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)
 

Plus de Cory Foy

Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...Cory Foy
 
Stratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right TimeStratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right TimeCory Foy
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestCory Foy
 
Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015Cory Foy
 
Code Katas
Code KatasCode Katas
Code KatasCory Foy
 
Distributed Agility
Distributed AgilityDistributed Agility
Distributed AgilityCory Foy
 
Scaling Agility
Scaling AgilityScaling Agility
Scaling AgilityCory Foy
 
Kanban for DevOps
Kanban for DevOpsKanban for DevOps
Kanban for DevOpsCory Foy
 
Ruby and OO for Beginners
Ruby and OO for BeginnersRuby and OO for Beginners
Ruby and OO for BeginnersCory Foy
 
Agile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the OrganizationAgile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the OrganizationCory Foy
 
Scrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at ScaleScrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at ScaleCory Foy
 
SQE Boston - When Code Cries
SQE Boston - When Code CriesSQE Boston - When Code Cries
SQE Boston - When Code CriesCory Foy
 
Rails as a Pattern Language
Rails as a Pattern LanguageRails as a Pattern Language
Rails as a Pattern LanguageCory Foy
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in RailsCory Foy
 
Agile Demystified
Agile DemystifiedAgile Demystified
Agile DemystifiedCory Foy
 
Ruby for C# Developers
Ruby for C# DevelopersRuby for C# Developers
Ruby for C# DevelopersCory Foy
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataCory Foy
 
Technically Distributed - Tools and Techniques for Distributed Teams
Technically Distributed - Tools and Techniques for Distributed TeamsTechnically Distributed - Tools and Techniques for Distributed Teams
Technically Distributed - Tools and Techniques for Distributed TeamsCory Foy
 
Growing and Fostering Software Craftsmanship
Growing and Fostering Software CraftsmanshipGrowing and Fostering Software Craftsmanship
Growing and Fostering Software CraftsmanshipCory Foy
 
IronRuby for the .NET Developer
IronRuby for the .NET DeveloperIronRuby for the .NET Developer
IronRuby for the .NET DeveloperCory Foy
 

Plus de Cory Foy (20)

Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
 
Stratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right TimeStratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right Time
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software West
 
Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015
 
Code Katas
Code KatasCode Katas
Code Katas
 
Distributed Agility
Distributed AgilityDistributed Agility
Distributed Agility
 
Scaling Agility
Scaling AgilityScaling Agility
Scaling Agility
 
Kanban for DevOps
Kanban for DevOpsKanban for DevOps
Kanban for DevOps
 
Ruby and OO for Beginners
Ruby and OO for BeginnersRuby and OO for Beginners
Ruby and OO for Beginners
 
Agile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the OrganizationAgile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the Organization
 
Scrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at ScaleScrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at Scale
 
SQE Boston - When Code Cries
SQE Boston - When Code CriesSQE Boston - When Code Cries
SQE Boston - When Code Cries
 
Rails as a Pattern Language
Rails as a Pattern LanguageRails as a Pattern Language
Rails as a Pattern Language
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in Rails
 
Agile Demystified
Agile DemystifiedAgile Demystified
Agile Demystified
 
Ruby for C# Developers
Ruby for C# DevelopersRuby for C# Developers
Ruby for C# Developers
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 
Technically Distributed - Tools and Techniques for Distributed Teams
Technically Distributed - Tools and Techniques for Distributed TeamsTechnically Distributed - Tools and Techniques for Distributed Teams
Technically Distributed - Tools and Techniques for Distributed Teams
 
Growing and Fostering Software Craftsmanship
Growing and Fostering Software CraftsmanshipGrowing and Fostering Software Craftsmanship
Growing and Fostering Software Craftsmanship
 
IronRuby for the .NET Developer
IronRuby for the .NET DeveloperIronRuby for the .NET Developer
IronRuby for the .NET Developer
 

Dernier

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Dernier (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Ruby for C# Developers

  • 1. Ruby for C# Developers Cory Foy http://www.cornetdesign.com St. Louis Code Camp May 6 th , 2006
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Ruby Basics - Exceptions process_file = File.open(“testfile.csv”) begin #put exceptional code in begin/end block #...process file rescue IOError => io_error puts “IOException occurred. Retrying.” retry #starts block over from begin rescue => other_error puts “Bad stuff happened: “ + other_error else #happens if no exceptions occur puts “No errors in processing. Yippee!” ensure # similar to finally in .NET/Java process_file.close unless process_file.nil? end
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50. Advanced Ruby - Mixins module Print def print puts “Company Confidential” yield end end class Document include Print #... end doc = Document.new doc.print { “Fourth Quarter looks great!” } -> Company Confidential -> Fourth Quarter looks great!
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.