1 / 20

Ruby and Rails

Ruby and Rails. From a. perspective. James Crisp .NET Practice Lead ThoughtWorks Australia. James Crisp. Runtimes MRI. IronRuby Console Demo. public class CSharpDemo : Demo { public void SayHello () { for ( int i =0; i <5; i ++) {

daria
Download Presentation

Ruby and Rails

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ruby and Rails From a perspective James Crisp .NET Practice Lead ThoughtWorks Australia

  2. James Crisp

  3. Runtimes MRI

  4. IronRuby Console Demo

  5. public class CSharpDemo : Demo • { • public void SayHello() • { • for (inti=0; i<5; i++) • { • Console.WriteLine(“Hi from C#!”); • } • } • public IEnumerable<string> Greet( • IEnumerable<guest> guests) • { • return guests.Select(g => “Welcome” • + g.Name); • } • }

  6. class RubyDemo < Demo • def say_hello • 5.times { puts “Hi from Ruby!” } • end • def greet(guests) • guests.collect { |g| “Welcome #{g.name}” } • end • end • >> RubyDemo.new.greet(fred, tina) • => [“Welcome Fred”, “Welcome Tina”]

  7. Tools and Frameworks

  8. c:\> gem install rails

  9. Rake • desc “Generate application code” • task :code_gen do • # do the code generation • end • desc “Compile code” • task :compile => [:code_gen] do • #do the compilation • end • desc “Test application” • task :test => [:compile] do • # run the tests • end

  10. Capistrano desc "Start ferret server" task :start, :role => :app do run "cd #{current_path}; script/ferret_server -e #{stage} start" end desc "Stop ferret server" task :stop, :role => :app do run "cd #{current_path}; script/ferret_server -e #{stage} stop" end

  11. RSpec describe User do it "should be in any roles assigned to it" do user = User.new user.assign_role("assigned role") user.shouldbe_in_role("assigned role") end ... end

  12. Routing Table Controller Method Model View

  13. Rails Project Demo

  14. See also... Rails & screencasts http://rubyonrails.org Ruby / Rails API http://gotapi.com John Lam's blog for Iron Ruby http://www.iunknown.com/ Slides for this talk http://www.jamescrisp.org

  15. Image References http://upload.wikimedia.org/wikipedia/en/2/27/Microsoft_.NET_Logo.png - .net logo http://en.wikipedia.org/wiki/Image:Ruby-(programming-language)-logo-2008.png http://www.pragprog.com/images/covers/original/rails3.jpg – agile development with rails http://flickr.com/photos/rrrodrigo/2394122680/ - Matz http://flickr.com/photos/maguisso/1028956186/ - Ruby book http://media.xircles.codehaus.org/_projects/jruby/_logos/medium.png – JRuby logo http://www.atdot.net/yarv/ - YARV logo http://www.ironruby.net/@api/deki/site/logo.png – IronRuby logo

  16. Questions?

More Related