Sha256: 047addf41585160ec20d993a32c85df488ca0d09f576121293320f20698acda5

Contents?: true

Size: 639 Bytes

Versions: 2

Compression:

Stored size: 639 Bytes

Contents

# encoding: utf-8

module Mutant
  # A mixing to create method object semantics
  module MethodObject

    # 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

  end # MethodObject
end # Mutant

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.3.0.rc1 lib/mutant/support/method_object.rb
mutant-0.3.0.beta22 lib/mutant/support/method_object.rb