Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/spec/should.rb

Instance Method Summary collapse

Instance Method Details

#replace_methods!(pattern, replacement) ⇒ Object



2
3
4
5
6
7
# File 'lib/minitest/spec/should.rb', line 2

def replace_methods!(pattern, replacement)
  public_instance_methods.grep(pattern).each do |method|
    alias_method method.to_s.sub(pattern, replacement), method
    send :undef_method, method
  end
end