2012-08-15 22:07:45 -04:00
|
|
|
module Mutant
|
|
|
|
# A mixing to create method object semantics
|
|
|
|
module MethodObject
|
2013-02-02 10:32:13 -05:00
|
|
|
|
2012-08-15 22:07:45 -04:00
|
|
|
# Hook called when descendant is extended
|
|
|
|
#
|
|
|
|
# @param [Module|Class] descendant
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def self.extended(descendant)
|
|
|
|
descendant.class_eval do
|
|
|
|
private_class_method :new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Run the method object
|
|
|
|
#
|
|
|
|
# Not aliased to prevent problems from inheritance
|
|
|
|
#
|
|
|
|
# @return [Objecct]
|
|
|
|
# returns the created object
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def run(*args)
|
|
|
|
new(*args)
|
|
|
|
end
|
2013-02-02 10:32:13 -05:00
|
|
|
|
2013-06-14 14:54:02 -04:00
|
|
|
end # MethodObject
|
|
|
|
end # Mutant
|