Method: Module#clone_using
- Defined in:
- lib/nano/module/clone_using.rb
#clone_using(*meths) ⇒ Object
Returns an anonymous module with only the specified methods of the receiving module intact.
6 7 8 9 10 11 12 |
# File 'lib/nano/module/clone_using.rb', line 6 def clone_using( *meths ) meths = meths.collect { |m| m.to_s } methods_to_remove = (self.instance_methods - meths) mod = self.dup mod.class_eval { methods_to_remove.each { |m| undef_method m } } return mod end |