Published on

An introduction to IronRuby, a ruby implementation built on the .Net framework and the Dynamic Language Runtime. This presentation was originally given at a Columbus Ruby Brigade meeting.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

  • IronRuby was originally started as a open source project in 2007, and was just released as v1.0 back on April 12th.

    DLR provides:
    Dynamic type system
    Dynamic Method Dispatch
    Dynamic Code Generation
    Hosting API
  • So the biggest thing about IronRuby is the interop between .Net Libraries and Ruby code.
    IronRuby alows you to access compiled .NET code in Ruby.
    It will even mangle method names to be more like Ruby’s naming idioms
  • So let’s jump into some code: example 1

    load_assembly is a new method that IronRuby is similar to require, but also adds the Global Assembly Cache to the list of locations it searches for.
    It will also look for the assembly by short name i.e. “System” instead of mscorlib.dll

  • IronRuby

    1. 1. IRONRUBY Alex Moore Consultant, HMB Inc.
    2. 2. ABOUT ME HMB .NET developer, some Java. On-again off-again relationship with Ruby since OSU
    3. 3. KON’NICHI WA, IRONRUBY IronRuby v1.0 Released April 12th, 2010 Compatible with 1.8.6 Runs on the DLR, which runs on the CLR .Net 4.0 / 2.0
    4. 4. INTEROP HOP Allows you to access compiled .NET code in Ruby It will even mangle the names to be more Ruby-esque WriteLine ==> write_line
    5. 5. INTEROP HOP load_assembly 'System' include System 5.times { puts "Odelay!" } Console.background_color = Console.foreground_color = ConsoleColor.white Console.write_line "DANGER, PONIES AHEAD!" Console.reset_color
    6. 6. EXECUTABLES ruby => ir irb => iirb gem => igem
    7. 7. TYPES .NET => Ruby Int32 => FixNum Double => Float Boolean => TrueClass, FalseClass DateTime => Time
    8. 8. .NET => RUBY Namespaces, Interfaces => Module Classes, Structs, Delegates, Enums => Class Constants, Static Methods => Class methods Methods => Instance Methods Fields, Properties => Getter/Setter methods
    9. 9. OTHER STUFF Abstract classes => Regular ruby classes w/o initializer Abstract methods => Override in subclass Virtual methods => Override in subclass Static methods => CAN override.
    10. 10. OTHER OTHER STUFF Private Binding Mode Makes all private and protected methods public ir -X:PrivateBinding ... to_clr_type() clr_member()
    11. 11. OK, SO WHAT ABOUT MY GEMS? Some work, some don’t. Ones that have native win32 code - no. Ruby only, some. New native pieces can be written in .NET languages.
    12. 12. WHAT ABOUT BOB RAILS? We has thems, 2.3.8 to be specific. Sql Server/ActiveRecord support too! Even an IIS module for Rack/Rails. Sinatra, HAML, SASS supported.
    13. 13. THIS IS DUMB, WHY WOULD I EVER USE THIS? You can use pretty much all the .NET libraries WPF / Forms for pretty UI Excel API - Because you know corporations are run on it Testing. Use cucumber/rspec to test .Net code. Get around the MS-only rules
    14. 14. CAVEAT _______ Can’t use win32 native gems Not 100% RubySpec - Currently ~86% Big Holes - RSS, Finalize, Shell, WeakRef, OpenSSL
    15. 15. 1.8.6?
    16. 16. 1.8.6? Next version will be either 1.8.7 or 1.9.x compatible
    17. 17. LICENSING Currently MS-PL OSI Certimafied Close to BSD Probably moving to Apache or MIT license soon.
    18. 18. RESOURCES IronRuby Unleashed - Shay Friedman IronRuby in Action - Ivan Porto Carrero and Adam Burmister
    19. 19. DOMO ARIGATO @alexmoore