Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
0a0afa7c
Commit
0a0afa7c
authored
Nov 23, 2014
by
TOMITA Masahiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix String#slice! raise TypeError or return invalid value.
parent
2c04f402
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
mrbgems/mruby-string-ext/mrblib/string.rb
mrbgems/mruby-string-ext/mrblib/string.rb
+4
-3
No files found.
mrbgems/mruby-string-ext/mrblib/string.rb
View file @
0a0afa7c
...
...
@@ -181,6 +181,7 @@ class String
ed
=
arg1
.
end
beg
+=
self
.
size
if
beg
<
0
ed
+=
self
.
size
if
ed
<
0
ed
-=
1
if
arg1
.
exclude_end?
validated
=
true
elsif
arg1
.
kind_of?
(
String
)
validated
=
true
...
...
@@ -198,18 +199,18 @@ class String
unless
str
==
nil
||
str
==
""
if
arg1
!=
nil
&&
arg2
!=
nil
idx
=
arg1
>=
0
?
arg1
:
self
.
size
+
arg1
str2
=
self
[
0
...
idx
]
+
self
[
idx
+
arg2
..-
1
]
str2
=
self
[
0
...
idx
]
+
self
[
idx
+
arg2
..-
1
]
.
to_s
else
if
arg1
.
kind_of?
(
Range
)
idx
=
beg
>=
0
?
beg
:
self
.
size
+
beg
idx2
=
ed
>=
0
?
ed
:
self
.
size
+
ed
str2
=
self
[
0
...
idx
]
+
self
[
idx2
+
1
..-
1
]
str2
=
self
[
0
...
idx
]
+
self
[
idx2
+
1
..-
1
]
.
to_s
elsif
arg1
.
kind_of?
(
String
)
idx
=
self
.
index
(
arg1
)
str2
=
self
[
0
...
idx
]
+
self
[
idx
+
arg1
.
size
..-
1
]
unless
idx
==
nil
else
idx
=
arg1
>=
0
?
arg1
:
self
.
size
+
arg1
str2
=
self
[
0
...
idx
]
+
self
[
idx
+
1
..-
1
]
str2
=
self
[
0
...
idx
]
+
self
[
idx
+
1
..-
1
]
.
to_s
end
end
self
.
replace
(
str2
)
unless
str2
==
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment