Files
mruby-mruby/mrblib/00class.rb
T
Yukihiro "Matz" Matsumoto 603005ba65 Integrate kazuho/mruby-class-new-fiber-safe in the master.
Avoid calling `initialize` via `mrb_funcall`, which cause `cross C
boundary` error from Fibers started in the method.
2019-08-14 14:09:56 +09:00

38 lines
591 B
Ruby

class Class
def new(*args, &block)
obj = self.allocate
obj.initialize(*args, &block)
obj
end
end
class Module
# 15.2.2.4.12
def attr_accessor(*names)
attr_reader(*names)
attr_writer(*names)
end
# 15.2.2.4.11
alias attr attr_reader
#def attr(name)
# attr_reader(name)
#end
# 15.2.2.4.27
def include(*args)
args.reverse.each do |m|
m.append_features(self)
m.included(self)
end
self
end
def prepend(*args)
args.reverse.each do |m|
m.prepend_features(self)
m.prepended(self)
end
self
end
end