Sha256: cdf7bc1cb03df899a70d5cfbe96b81edfe85d80eba5f81ab9d759fd8b4111016

Contents?: true

Size: 397 Bytes

Versions: 1

Compression:

Stored size: 397 Bytes

Contents

class Module

  # Prepend an +aspect+ module to a module.
  # This only works at the module level.
  #
  #   module ::PreX
  #     def x; "x"; end
  #   end
  #
  #   module ::PreU
  #     def x; '{' + super + '}'; end
  #   end
  #
  #   PreX.prepend(PreU)
  #
  #   PreX.x  # => "{x}"
  #
  # CREDIT Trans

  def prepend(aspect)
    aspect.__send__(:include, self)
    extend aspect
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-2.9.0.pre.1 lib/tour/facets/module/prepend.rb