From: Kenny Date: 2008-10-25T18:04:58+09:00 Subject: Conditionally Including Methods From A Module? Is there a way to include only certain methods from a module instead of all the methods? Given the following: module ActsAsAnything def self.included(base) base.extend(ClassMethods) end module ClassMethods def acts_as_anything(opts = {}) # Based on the options based in, I would like to selectively include certain methods from # the InstanceMethods module. # Something like: include ActsAsAnything::InstanceMethods.instance_method(:index) if opts[:include_index] include ActsAsAnything::InstanceMethods.instance_method(:list) if opts[:include_list] # (Note the 'if' condition above is just for example.... ) end end module InstanceMethods def index # ..... end def list # .... end end end However, 'include' requires a module and I can't figure out the proper syntax, or even if this is possible, to just include a certain method from it. The is for a standard acts_as_.... Rails plug-in. Any help or guidance is much appreciated. Sincerely, Kenny