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
fd37bc53
Commit
fd37bc53
authored
May 15, 2019
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `String#=~` and `String#match` that requires `Regexp`.
parent
d8eff635
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
17 deletions
+7
-17
mrblib/string.rb
mrblib/string.rb
+7
-17
No files found.
mrblib/string.rb
View file @
fd37bc53
...
@@ -230,26 +230,16 @@ class String
...
@@ -230,26 +230,16 @@ class String
end
end
end
end
def
_regexp
(
re
,
mid
)
# those two methods requires Regexp that is optional in mruby
if
String
===
re
if
Object
.
const_defined?
(
:Regexp
)
return
Regexp
.
new
(
re
)
else
raise
NotImplementedError
,
"String#
#{
mid
}
needs Regexp class"
end
end
re
end
##
##
# ISO 15.2.10.5.3
# ISO 15.2.10.5.3
def
=~
(
re
)
#
def =~(re)
_regexp
(
re
,
:
=~
)
=~
self
# re
=~ self
end
#
end
##
##
# ISO 15.2.10.5.27
# ISO 15.2.10.5.27
def
match
(
re
,
&
block
)
#
def match(re, &block)
_regexp
(
re
,
:match
)
.
match
(
self
,
&
block
)
# re
.match(self, &block)
end
#
end
end
end
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