[Ironruby-core] accessor methods and property syntax in .NET

Ivan Porto Carerro ivan at flanders.co.nz
Tue Sep 7 05:01:16 EDT 2010

You can just define them as attr_accessors and then implement the methods

class Foo

  attr_accessor :bar, :baz

  def bar=(val)
    # do more stuff here for example
    @bar = val

  def bar


On Tue, Sep 7, 2010 at 10:36 AM, Davy Brion <ralinx at davybrion.com> wrote:

> Hi all,
> IronRuby has a nice trick where attributes defined by attr_reader,
> attr_accessor and attr_writer are usable as properties from C#... i was just
> wondering: is it possible to use the same trick in our own ruby code?
> or can anyone just point me in the right direction as to where in the
> IronRuby source code i could find where this is being done?
> I have accessor methods that really need to do something specific and
> ideally, i'd like them be usable as properties in .NET since it leads to a
> much nicer syntax in C#
> brs,
> Davy
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100907/b08ec86b/attachment-0001.html>

More information about the Ironruby-core mailing list