forked from rubyworks/facets
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug squash session with module extensions
- Loading branch information
Showing
30 changed files
with
335 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
require 'facets/module/revise' | ||
require 'facets/module/redirect_method' | ||
require 'facets/module/redefine_method' | ||
require 'facets/module/rename_method' | ||
require 'facets/module/wrap_method' | ||
require 'facets/module/nodef' | ||
|
||
class Module | ||
|
||
# Using integrate is just like using include except the | ||
# module included is a reconstruction of the one given | ||
# altered by the commands given in the block. | ||
# | ||
# Convenient commands available are: #rename, #redef, | ||
# #remove, #nodef and #wrap. But any module method | ||
# can be used. | ||
# | ||
# module IntegrateExampleModule | ||
# def q ; "q" ; end | ||
# def y ; "y" ; end | ||
# end | ||
# | ||
# class InegrateExampleClass | ||
# integrate IntegrateExampleModule do | ||
# undef_method :y | ||
# end | ||
# end | ||
# | ||
# x = InegrateExampleClass.new | ||
# x.q #=> "q" | ||
# | ||
# expect NameError do | ||
# x.y | ||
# end | ||
# | ||
# This is like #revisal, but #revisal only | ||
# returns the reconstructred module. It does not | ||
# include it. | ||
# | ||
# CREDIT: Trans | ||
|
||
def integrate(mod, &block) | ||
#include mod.revisal( &blk ) | ||
m = Module.new{ include mod } | ||
m.class_eval(&block) | ||
include m | ||
end | ||
|
||
end | ||
|
Oops, something went wrong.