Sha256: 645250a8d8c26c3ba407442a6d8e6b8365f7b383ee6c5755eaeb504f69ad1732

Contents?: true

Size: 566 Bytes

Versions: 4

Compression:

Stored size: 566 Bytes

Contents

class Module
  private
  # Alias a module function so that the alias is also
  # a module function. The typical #alias_method 
  # does not do this.
  #
  #   require 'facet/moodule/alias_module_function'
  #
  #   module Demo
  #     module_function
  #     def hello
  #       "Hello"
  #     end
  #   end
  #
  #   Demo.hello    #=> Hello
  #
  #   module Demo
  #     alias_module_function( :hi , :hello )
  #   end
  #
  #   Demo.hi       #=> Hello
  #
  def alias_module_function( new, old )
    alias_method( new, old )
    module_function( new )
  end 
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-0.6.3 lib/facet/module/alias_module_function.rb
facets-0.7.0 lib/facet/module/alias_module_function.rb
facets-0.7.1 lib/facet/module/alias_module_function.rb
facets-0.7.2 lib/facet/module/alias_module_function.rb