Sha256: c448020b33eb8464e90ab82d173f1c3915b896b2722edd93bc854a3cb3326689

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

module Kernel

  alias_method :_extend, :extend

  private :_extend

  # Extend an object with a module.
  #
  # If a block is given, it will be evaluated into an anonymous
  # module and used to extend the object.
  #
  #   obj = Object.new
  #
  #   obj.extend do
  #     def foo; "foo"; end
  #   end
  #
  #   obj.foo  #=> "foo"
  #
  # NOTE: This is one of the few core overrides in Facets.
  #
  # @author Trans
  # @author Marco Otte-Witte (bug fix)
  def extend(*mod, &blk)
    _extend(*mod) unless mod.empty?
    _extend Module.new(&blk) if blk
    self
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/kernel/extend.rb