Files
mruby-mruby/mrblib/00class.rb
T
dearblue 9d04183ce1 Small improvements to Module#{include,prepend}
Array objects obtained as splat arguments are generated within the method.
Therefore, it is safe to perform destructive operations.
2022-03-06 13:43:31 +09:00

42 lines
602 B
Ruby

class BasicObject
def !=(other)
if self == other
false
else
true
end
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!
args.each do |m|
m.append_features(self)
m.included(self)
end
self
end
def prepend(*args)
args.reverse!
args.each do |m|
m.prepend_features(self)
m.prepended(self)
end
self
end
end