mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-toplevel-ext: add comprehensive call-seq documentation for toplevel include
Added complete call-seq documentation for the toplevel include method in mrblib/toplevel.rb (1 method): - include: enables module inclusion at the toplevel scope, delegates to Object.include to make module methods available to all objects globally, provides convenient syntax for extending the global namespace with module functionality Co-authored-by: Atlassian Rovo Dev
This commit is contained in:
@@ -1,6 +1,23 @@
|
||||
class <<self
|
||||
private
|
||||
|
||||
#
|
||||
# call-seq:
|
||||
# include(module, ...) -> self
|
||||
#
|
||||
# Invokes Module.append_features on each parameter in reverse order.
|
||||
# When called at the toplevel, this includes the module(s) into Object,
|
||||
# making their methods available to all objects.
|
||||
#
|
||||
# module Greeting
|
||||
# def hello
|
||||
# "Hello, world!"
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# include Greeting
|
||||
# "".hello #=> "Hello, world!"
|
||||
#
|
||||
def include(*modules)
|
||||
Object.include(*modules)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user