Method: Module#include_as

Defined in:
lib/core/facets/module/method_space.rb

#include_as(h) ⇒ Object

Include a module via a specified space.

module T
  def t ; "HERE" ; end
end

class X
  include_as :test => T
  def t ; test.t ; end
end

X.new.t  #=> "HERE"

NOTE: This method is not a common core extension and is not loaded automatically when using require 'facets'.

Uncommon:

  • require ‘facets/module/method_space’



103
104
105
# File 'lib/core/facets/module/method_space.rb', line 103

def include_as(h)
  h.each{ |name, mod| method_space(name, mod) }
end