mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
ec1f9860b1
added parentheses to all `to_enum` and `super` calls where the return value is used (returned, assigned, or passed to another method). this makes the code style consistent with the guideline that method calls should use parentheses when their return values are consumed. changes: - return to_enum :symbol -> return to_enum(:symbol) - return to_enum :symbol, arg -> return to_enum(:symbol, arg) - super message, name -> super(message, name) affected files: 10error.rb, array.rb, enum.rb, hash.rb, kernel.rb, numeric.rb, range.rb Co-authored-by: Claude <noreply@anthropic.com>
46 lines
735 B
Ruby
46 lines
735 B
Ruby
##
|
|
# Kernel
|
|
#
|
|
# ISO 15.3.1
|
|
module Kernel
|
|
|
|
# 15.3.1.2.1 Kernel.`
|
|
# provided by Kernel#`
|
|
# 15.3.1.3.3
|
|
def `(s)
|
|
raise NotImplementedError.new("backquotes not implemented")
|
|
end
|
|
|
|
##
|
|
# 15.3.1.2.3 Kernel.eval
|
|
# 15.3.1.3.12 Kernel#eval
|
|
# NotImplemented by mruby core; use mruby-eval gem
|
|
|
|
##
|
|
# ISO 15.3.1.2.8 Kernel.loop
|
|
# not provided by mruby
|
|
|
|
##
|
|
# Calls the given block repetitively.
|
|
#
|
|
# ISO 15.3.1.3.29
|
|
private def loop(&block)
|
|
return to_enum(:loop) unless block
|
|
|
|
while true
|
|
yield
|
|
end
|
|
rescue StopIteration => e
|
|
e.result
|
|
end
|
|
|
|
# 11.4.4 Step c)
|
|
def !~(y)
|
|
!(self =~ y)
|
|
end
|
|
|
|
def to_enum(*a)
|
|
raise NotImplementedError.new("fiber required for enumerator")
|
|
end
|
|
end
|