Sha256: 794b5612d1b5306063f8ecef54ee2d9a585324fa88f1b91b5b810926ce40dacc

Contents?: true

Size: 377 Bytes

Versions: 10

Compression:

Stored size: 377 Bytes

Contents

class Module

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

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

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.8.4 lib/core/facets/module/prepend.rb
facets-2.8.3 lib/core/facets/module/prepend.rb
facets-2.8.2 lib/core/facets/module/prepend.rb
facets-2.8.1 lib/core/facets/module/prepend.rb
facets-2.8.0 lib/core/facets/module/prepend.rb
facets-2.7.0 lib/core/facets/module/prepend.rb
facets-2.6.0 lib/core/facets/module/prepend.rb
facets-2.5.1 lib/core/facets/module/prepend.rb
facets-2.5.0 lib/core/facets/module/prepend.rb
facets-2.5.2 lib/core/facets/module/prepend.rb