IronRuby idiom for using (IDisposable)?

Hello,

Is there a built-in way to achieve what C# ‘using’ does, with IronRuby ?

Although it’s pretty easy to roll your own (
http://myotherpants.com/2009/09/disposable-code), I’d like to use the
built-in way if there’s one.

thanks!

– Thibaut

yes

http://github.com/casualjim/ironnails/blob/master/IronNails/vendor/iron_nails/lib/core_ext/kernel.rb#L17

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Mon, Feb 1, 2010 at 10:03 AM, Thibaut Barrère

you don’t need to provide the true anymore. It was a bug a year ago and
I
still have to update that

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Mon, Feb 1, 2010 at 10:07 AM, Ivan Porto C. <

it’s not a rubyism as such, so I don’t think it actually belongs in the
core. But opinions may vary

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Mon, Feb 1, 2010 at 10:21 AM, Thibaut Barrère

Thanks Ivan,

I like your version :slight_smile:

Will something similar be added directly into IronRuby Kernel ?

– Thibaut

On Mon, Feb 1, 2010 at 10:07 AM, Ivan Porto C. <

it’s not a rubyism as such, so I don’t think it actually belongs in the
core. But opinions may vary

agreed - it’s an ironrubyism :slight_smile:

I think we can add it straight to the FAQ, to the very least!

– Thibaut

On Mon, Feb 1, 2010 at 10:46, Thibaut Barrère
[email protected] wrote:

it’s not a rubyism as such, so I don’t think it actually belongs in the
core. But opinions may vary

agreed - it’s an ironrubyism :slight_smile:

I’m definitely against adding such a feature to the core (as Ivan
said, it doesn’t belong to ruby), but…

require ‘ironrubysm’ # just to reuse your term, but it could be
something along these lines :slight_smile:

Maybe we can have a separate gem that groups a bunch of typical .NET
patterns in a more rubyish way. Thoughts?


Daniele A.
http://www.clorophilla.net/
http://twitter.com/JoL1hAHN

Maybe we can have a separate gem that groups a bunch of typical .NET
patterns in a more rubyish way. Thoughts?

I think it’s a nice idea; it would be a bit like Facets (
http://facets.rubyforge.org/), small bits that you can enable if you
wish.

– Thibaut

I also think it’s a nice idea. I have a few other such methods
(Array#to_clr_a, Time#to_clr_time, and the godawful Array#to_2d_a) that
seem
like they’d also be a good fit :slight_smile:

On Mon, Feb 1, 2010 at 11:17 PM, Thibaut Barrère

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs