Sha256: 31fc508d43ad37bcb19c93600064d6d1da1f8daf2e3ae66fbbec91009282846c

Contents?: true

Size: 420 Bytes

Versions: 5

Compression:

Stored size: 420 Bytes

Contents

class Module
  # Removes the named method, if it exists.
  def remove_possible_method(method)
    if method_defined?(method) || private_method_defined?(method)
      undef_method(method)
    end
  end

  # Replaces the existing method definition, if there is one, with the passed
  # block as its body.
  def redefine_method(method, &block)
    remove_possible_method(method)
    define_method(method, &block)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-activesupport-0.3.3 opal/active_support/core_ext/module/remove_method.rb
opal-activesupport-0.3.2 opal/active_support/core_ext/module/remove_method.rb
opal-activesupport-0.3.1 opal/active_support/core_ext/module/remove_method.rb
opal-activesupport-0.3.0 opal/active_support/core_ext/module/remove_method.rb
opal-activesupport-0.2.0 opal/active_support/core_ext/module/remove_method.rb