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.
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. OTHER OTHER STUFF
Private Binding Mode
Makes all private and protected methods public
ir -X:PrivateBinding ...
to_clr_type()
clr_member()
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. 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. 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. CAVEAT _______
Can’t use win32 native gems
Not 100% RubySpec - Currently ~86%
Big Holes - RSS, Finalize, Shell, WeakRef, OpenSSL
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