Sha256: 3a4a74f91ce9bbcb172497710e6bfec357afadf040921e0061e48b79b041dcb4

Contents?: true

Size: 509 Bytes

Versions: 6

Compression:

Stored size: 509 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 overrides in Facents.
  def extend(*mod, &blk)
    _extend(*mod) unless mod.empty?
    _extend Module.new(&blk) if blk
    self
  end

end

Version data entries

6 entries across 5 versions & 1 rubygems

Version Path
facets-2.9.2 lib/core/facets/kernel/extend.rb
facets-2.9.2 src/core/facets/kernel/extend.rb
facets-2.9.1 lib/core/facets/kernel/extend.rb
facets-2.9.0 lib/core/facets/kernel/extend.rb
facets-2.9.0.pre.2 lib/core/facets/kernel/extend.rb
facets-2.9.0.pre.1 lib/core/facets/kernel/extend.rb