comopasta Gr wrote in post #1024192:
> I guess I could make a small module and require it, but then I need to
> require it two times. I'm starting to think about memory even though for
> this it would be very cheap anyway.

Sounds like you're confusing "include" with "require". You could 
"require" a file 50 times, but Ruby would loading it only once.

If you create a ruby module in would use "include" to include the module 
into a class. But, it seems like a bit of overkill to create a module 
that containing no methods, but only a single constant. I think I'd 
simply put the constant on whatever class is dealing with your color 
pallets.

Example:

class MyController
  DARK_PALETTE = {
    :background => "323232",
    :header => "4d4c4d"
  }
  ...
  ...
end

Then from anywhere else you need the constant:

MyController::DARK_PALETTE

The other, probably better, option would be to setup a custom 
configuration YAML file that includes all your application specific 
constants that gets loaded at startup. That way application wide 
settings are separated from the application's code.

There was a Railscasts episode a good while back that showed an example 
of setting up a YAML Configuration File:

http://railscasts.com/episodes/85-yaml-configuration-file

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to