Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/dbus/core_ext/module/remove_method.rb

Overview

Instance Method Summary collapse

Instance Method Details

#redefine_method(method, &block) ⇒ Object



10
11
12
13
# File 'lib/dbus/core_ext/module/remove_method.rb', line 10

def redefine_method(method, &block)
  remove_possible_method(method)
  define_method(method, &block)
end

#remove_possible_method(method) ⇒ Object



4
5
6
7
8
# File 'lib/dbus/core_ext/module/remove_method.rb', line 4

def remove_possible_method(method)
  if method_defined?(method) || private_method_defined?(method)
    undef_method(method)
  end
end