C:\temp [42] > rbd IronRuby 0.9.0.0 on .NET 2.0.50727.4927 Copyright (c) Microsoft Corporation. All rights reserved.
>>> require 'temp.dll' => true >>> @c = Customer.new => Customer >>> @c.FirstName => nil >>> @c.first_name => nil >>> @c.FirstName = 's' => "s" >>> @c.first_name => 's' >>> @c.FirstName => 's' >>> @c.first_name = 's' => "s" >>> @c.first_name => 's' >>> @c.FirstName => 's' >>> In particular, IR mangles CamelCase into snake_case for most .NET methods, but it doesn't work for pure Ruby methods. In addition, certain builtin types, such as Object and Fixnum are the same type as System.Object and System.Int32 (respectively), so they don't mangle names. When in doubt, you should always be able to call a method by its proper .NET name, and you can use #methods to get a list of the methods that an object responds to. (in this case, @c.methods would have 'first_name' and 'first_name=' method in the list. JD From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Shay Friedman Sent: Wednesday, September 23, 2009 9:14 PM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] CLR Properties in IronRuby @customer.first_name = 's' This is called name mangling when IronRuby make CLR name Ruby-like. Shay. ----------------------------- Shay Friedman Author of "IronRuby Unleashed" http://www.IronShay.com Follow me: http://twitter.com/ironshay On Thu, Sep 24, 2009 at 6:59 AM, Mohammad Azam <azamsh...@gmail.com<mailto:azamsh...@gmail.com>> wrote: How can I refer to the CLR properties in IronRuby. public class Customer { public string FirstName { get;set; } } In Ruby: @customer.FirstName = 's' OR @customer.firstname = 's' -- Mohammad Azam MVP (Microsoft Valuable Professional) www.highoncoding.com<http://www.highoncoding.com> www.azamsharp.com<http://www.azamsharp.com> _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core