Hi, I am using IR to do some IronRuby programing and enjoying it! I created a Form like this: Form = System::Windows::Forms::Form form = Form.new form.ShowDialog() Now, I need to assign BackColor to the Form. I tried the following: form.BackColor = System::Drawing::Color::DeekPink But it is not able to recognize the Color class.>>> form.BackColor = System::Drawing::Color::DeepPink:0:in `const_missing'': uninitialized constant System::Drawing::Color::DeepPink ( NameError) from :0 Any ideas! -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2009-Jun-16 16:10 UTC
[Ironruby-core] Accessing Enumeration in IronRuby
try System::Drawing::Color.deep_pink :) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, Jun 16, 2009 at 6:04 PM, Mohammad Azam <lists at ruby-forum.com> wrote:> Hi, > > I am using IR to do some IronRuby programing and enjoying it! > > I created a Form like this: > > Form = System::Windows::Forms::Form > form = Form.new > form.ShowDialog() > > Now, I need to assign BackColor to the Form. I tried the following: > > form.BackColor = System::Drawing::Color::DeekPink > > But it is not able to recognize the Color class. > > > >>> form.BackColor = System::Drawing::Color::DeepPink > :0:in `const_missing'': uninitialized constant > System::Drawing::Color::DeepPink ( > NameError) > from :0 > > Any ideas! > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > 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/20090616/f77c29a1/attachment.html>
You''re close; you want "System::Drawing::Color.DeepPink". -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Mohammad Azam Sent: Tuesday, June 16, 2009 9:04 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Accessing Enumeration in IronRuby Hi, I am using IR to do some IronRuby programing and enjoying it! I created a Form like this: Form = System::Windows::Forms::Form form = Form.new form.ShowDialog() Now, I need to assign BackColor to the Form. I tried the following: form.BackColor = System::Drawing::Color::DeekPink But it is not able to recognize the Color class.>>> form.BackColor = System::Drawing::Color::DeepPink:0:in `const_missing'': uninitialized constant System::Drawing::Color::DeepPink ( NameError) from :0 Any ideas! -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Thanks it worked! But why the inconsistency with the deep_pink instead of DeepPink? -- Posted via http://www.ruby-forum.com/.
Curt Hagenlocher wrote:> You''re close; you want "System::Drawing::Color.DeepPink".Thanks Curt! It worked out :) -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2009-Jun-16 16:23 UTC
[Ironruby-core] Accessing Enumeration in IronRuby
So what is up with naming conventions.. are it ruby naming conventions or CLR naming conventions? I''m going to argue in favor of ruby naming conventions. Is there going to be a definitive list for this? (naming conventions being a pet peeve of mine) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, Jun 16, 2009 at 6:10 PM, Curt Hagenlocher <curth at microsoft.com>wrote:> You''re close; you want "System::Drawing::Color.DeepPink". > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Tuesday, June 16, 2009 9:04 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Accessing Enumeration in IronRuby > > Hi, > > I am using IR to do some IronRuby programing and enjoying it! > > I created a Form like this: > > Form = System::Windows::Forms::Form > form = Form.new > form.ShowDialog() > > Now, I need to assign BackColor to the Form. I tried the following: > > form.BackColor = System::Drawing::Color::DeekPink > > But it is not able to recognize the Color class. > > > >>> form.BackColor = System::Drawing::Color::DeepPink > :0:in `const_missing'': uninitialized constant > System::Drawing::Color::DeepPink ( > NameError) > from :0 > > Any ideas! > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > 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/20090616/0095b81d/attachment.html>
IronRuby does "name mangling" on many methods to look more Rubyish. The standard idiom in Ruby is to have methods with snake_case names, so this fits with that. Both DeepPink and deep_pink should work in this case. JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Tuesday, June 16, 2009 9:17 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Accessing Enumeration in IronRuby > > Thanks it worked! > > But why the inconsistency with the deep_pink instead of DeepPink? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Not sure what you mean. For .NET methods on most types, we mangle both ways. You can call deep_pink or DeepPink. There are certain CLR classes (ones that map to Ruby Builtins) that don?t mangle to avoid conflicts, but for the most part, it is up to the developer. That said, I prefer to stick with what I see as the Ruby community coding standards: ? 2 space indent ? snake_case method names ? parenthesis for method definitions ? no parenthesis for method calls unless it is chained or ambiguous And others listed on this page http://www.caliban.org/ruby/rubyguide.shtml JD ?there is no try From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, June 16, 2009 9:24 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Accessing Enumeration in IronRuby So what is up with naming conventions.. are it ruby naming conventions or CLR naming conventions? I''m going to argue in favor of ruby naming conventions. Is there going to be a definitive list for this? (naming conventions being a pet peeve of mine) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, Jun 16, 2009 at 6:10 PM, Curt Hagenlocher <curth at microsoft.com<mailto:curth at microsoft.com>> wrote: You''re close; you want "System::Drawing::Color.DeepPink". -----Original Message----- From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of Mohammad Azam Sent: Tuesday, June 16, 2009 9:04 AM To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> Subject: [Ironruby-core] Accessing Enumeration in IronRuby Hi, I am using IR to do some IronRuby programing and enjoying it! I created a Form like this: Form = System::Windows::Forms::Form form = Form.new form.ShowDialog() Now, I need to assign BackColor to the Form. I tried the following: form.BackColor = System::Drawing::Color::DeekPink But it is not able to recognize the Color class.>>> form.BackColor = System::Drawing::Color::DeepPink:0:in `const_missing'': uninitialized constant System::Drawing::Color::DeepPink ( NameError) from :0 Any ideas! -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto: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/20090616/ce92a8f2/attachment.html>
Without thinking, I just used the same convention as the original question and didn?t mean to imply anything by it. I mostly live in other languages, so it didn?t even stand out. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, June 16, 2009 9:24 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Accessing Enumeration in IronRuby So what is up with naming conventions.. are it ruby naming conventions or CLR naming conventions? I''m going to argue in favor of ruby naming conventions. Is there going to be a definitive list for this? (naming conventions being a pet peeve of mine) --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, Jun 16, 2009 at 6:10 PM, Curt Hagenlocher <curth at microsoft.com<mailto:curth at microsoft.com>> wrote: You''re close; you want "System::Drawing::Color.DeepPink". -----Original Message----- From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of Mohammad Azam Sent: Tuesday, June 16, 2009 9:04 AM To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> Subject: [Ironruby-core] Accessing Enumeration in IronRuby Hi, I am using IR to do some IronRuby programing and enjoying it! I created a Form like this: Form = System::Windows::Forms::Form form = Form.new form.ShowDialog() Now, I need to assign BackColor to the Form. I tried the following: form.BackColor = System::Drawing::Color::DeekPink But it is not able to recognize the Color class.>>> form.BackColor = System::Drawing::Color::DeepPink:0:in `const_missing'': uninitialized constant System::Drawing::Color::DeepPink ( NameError) from :0 Any ideas! -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto: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/20090616/080d025a/attachment.html>
Ivan Porto Carrero
2009-Jun-16 19:01 UTC
[Ironruby-core] Accessing Enumeration in IronRuby
I was also a bit short in my answer.. realised I was running late for a meeting with a guy about cash-bootstrapping my new business; not exactly what I want to be running late for :) I do prefer the ruby naming conventions too :) I just want to document those things properly in the book so that there are no surprises. Something like: I advice to use ruby naming conventions except in the following cases..... I guess the exceptions will be on the wiki --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Tue, Jun 16, 2009 at 7:00 PM, Curt Hagenlocher <curth at microsoft.com>wrote:> Without thinking, I just used the same convention as the original question > and didn?t mean to imply anything by it. I mostly live in other languages, > so it didn?t even stand out. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Tuesday, June 16, 2009 9:24 AM > > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] Accessing Enumeration in IronRuby > > > > So what is up with naming conventions.. are it ruby naming conventions or > CLR naming conventions? > > > > I''m going to argue in favor of ruby naming conventions. > > Is there going to be a definitive list for this? (naming conventions being > a pet peeve of mine) > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > > On Tue, Jun 16, 2009 at 6:10 PM, Curt Hagenlocher <curth at microsoft.com> > wrote: > > You''re close; you want "System::Drawing::Color.DeepPink". > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Tuesday, June 16, 2009 9:04 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Accessing Enumeration in IronRuby > > Hi, > > I am using IR to do some IronRuby programing and enjoying it! > > I created a Form like this: > > Form = System::Windows::Forms::Form > form = Form.new > form.ShowDialog() > > Now, I need to assign BackColor to the Form. I tried the following: > > form.BackColor = System::Drawing::Color::DeekPink > > But it is not able to recognize the Color class. > > > >>> form.BackColor = System::Drawing::Color::DeepPink > :0:in `const_missing'': uninitialized constant > System::Drawing::Color::DeepPink ( > NameError) > from :0 > > Any ideas! > -- > > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > 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/20090616/7c9a740a/attachment.html>