Module: Mechanize::Prependable
- Defined in:
- lib/mechanize/prependable.rb
Overview
Fake implementation of prepend(), which does not support overriding inherited methods nor methods that are formerly overridden by another invocation of prepend().
Here's what
-
Create an anonymous stub module (hereinafter
) and define # that calls # _without_ for each instance method of . -
Rename
# to # _without_ for each instance method of . -
Include
and into in that order.
This way, a call of
Usage:
class Mechanize
# module with methods that overrides those of X
module Y
end
unless X.respond_to?(:prepend, true)
require 'mechanize/prependable'
X.extend(Prependable)
end
class X
prepend Y
end
end