Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mrbgems/mruby-bin-mruby/bintest/mruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ def hoge
# The regexp-aware override in mruby-regexp/mrblib/string_regexp.rb used to
# replace the C-defined String#split, leaving its `return super if ...`
# fast paths with no method to delegate to (NoMethodError). Now the
# override delegates via `__split`, an alias of the original C method
# installed in mrb_mruby_regexp_gem_init before mrblib runs.
# override delegates via `__split`, an alias of the original C method made
# at the top of that class body before the override replaces it.
assert_mruby(%Q(["a", "b", "c"]\n), "", true,
["-e", 'p "a,b,c".split(",")'])
assert_mruby(%Q(["abc", "abc", "abc"]\n), "", true,
Expand Down
6 changes: 3 additions & 3 deletions mrbgems/mruby-regexp/mrblib/string_regexp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@ def scan(pattern)
end

# Regexp-aware split. Falls back to the C-defined split (aliased as
# `__split` in mrb_mruby_regexp_gem_init before this override loads) for
# nil or string patterns, and handles regexp patterns in Ruby.
# `__split` above) for nil or string patterns, and handles regexp patterns
# in Ruby.
def split(pattern = nil, *args)
if args.length > 1
raise ArgumentError, "wrong number of arguments (given #{args.length + 1}, expected 0..2)"
end

limit_given = args.length > 0
limit = limit_given ? args[0] : 0
# `__to_int` is `mrb_ensure_integer_type()`, which asks the object nothing.
# `Integer.__ensure` is `mrb_ensure_int_type()`, which asks the object nothing.
# mruby has no implicit conversion protocol in core, so `Array.new(obj)`,
# `ary[obj]` and `"s" * obj` all reject an object that only defines
# `to_int`; dispatching it here would leave this the one place in the tree
Expand Down
Loading