From: Daniel Waite Date: 2008-05-02T13:19:54+09:00 Subject: Re: DSL - class-level methods that affect instances Daniel Waite wrote: > Thank you both, Ken and David, very much! Here she is, best of both approaches! module Translator module ClassMethods attr_reader :translations def translate(from_word, options) @translations ||= Hash.new @translations[from_word] = options[:to] end end def self.included(receiver) receiver.extend(ClassMethods) end def translations self.class.translations end class Base include Translator end end class NewTranslator < Translator::Base translate 'customer_profile_id', :to => 'customerProfileId' end p NewTranslator.new.translations I feel a little odd putting the class Base declaration at the end of the module, but if it's not there it has to be outside it entirely (and it must still occur _after_ the code inside the module), something I don't really want to do. Anywho, thanks again for the awesome help. You guys rock! -- Posted via http://www.ruby-forum.com/.