Method: Object#extend_complete

Defined in:
lib/include_complete.rb

#extend_complete(*mods) ⇒ Object

extend modules (and their singletons) into an inheritance chain

Examples:

module M
  def self.hello
    puts "hello"
  end
end
o = Object.new
o.extend_complete M
o.singleton_class.hello #=> "hello"

Parameters:

  • mods (Module)

    Modules to extend_complete

Returns:

  • Returns the receiver



59
60
61
# File 'lib/include_complete.rb', line 59

def extend_complete(*mods)
  class << self; self; end.send(:include_complete, *mods)
end