Sha256: 497afbd60217cee107ec9ff743a1939b8700e47848dfe7be095b59754ea4a3f0

Contents?: true

Size: 407 Bytes

Versions: 4

Compression:

Stored size: 407 Bytes

Contents

class Module

  private

  # Aliases a method and undefines the original.
  #
  #   rename_method( :to_method, :from_method  )
  #
  #  CREDIT: Trans

  def rename_method( to_sym, from_sym )
    raise ArgumentError, "method #{from_sym} does not exist" unless method_defined?( from_sym )
    alias_method( to_sym, from_sym )
    undef_method( from_sym )
  end

  alias_method :rename,   :rename_method

end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
facets-2.4.3 lib/core/facets/module/rename_method.rb
facets-2.4.4 lib/core/facets/module/rename_method.rb
facets-2.4.5 lib/core/facets/module/rename_method.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/module/rename_method.rb