Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #2213
| From | Stefan Salewski <mail@ssalewski.de> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: Using variables in modules |
| Date | 2011-04-03 15:29 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <1301862550.2788.4.camel@AMD64X2.fritz.box> (permalink) |
| References | <1301790250.3173.40.camel@AMD64X2.fritz.box> <20110403103615.1068791b@user-GA-MA785GM-US2H> |
On Mon, 2011-04-04 at 02:37 +0900, spiralofhope wrote: > You're not defining a variable. You're defining a constant with the > capital G. Use lowercases and this should work just fine. > I know. Please note that lower case letter will not work in this context: module Gravity g = 9.81 end puts Gravity::g Gravity::g = 9.8102 puts Gravity::g >iii.rb:4: undefined method `g' for Gravity:Module (NoMethodError) Brian Candler and Stefano Crocco already answered my question, thanks.
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Using variables in modules Stefan Salewski <mail@ssalewski.de> - 2011-04-02 19:30 -0500
Re: Using variables in modules Stefan Salewski <mail@ssalewski.de> - 2011-04-02 19:57 -0500
Re: Using variables in modules Stefano Crocco <stefano.crocco@alice.it> - 2011-04-03 01:39 -0500
Re: Using variables in modules Brian Candler <b.candler@pobox.com> - 2011-04-03 02:55 -0500
Re: Using variables in modules spiralofhope <spiralofhope_rubyml@lavabit.com> - 2011-04-03 12:37 -0500
Re: Using variables in modules Stefan Salewski <mail@ssalewski.de> - 2011-04-03 15:29 -0500
Re: Using variables in modules Brian Candler <b.candler@pobox.com> - 2011-04-03 15:30 -0500
csiph-web