39 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto c022e4643f Avoid assignments from type checking String#__to_str. 2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto ff08856fe3 Remove implicit conversion using to_str method; fix #3854
We have added internal convenience method `__to_str` which
does string type check.

The issue #3854 was fixed but fundamental flaw of lack of stack
depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA`
for workaround.
2018-11-19 12:05:46 +09:00
Yukihiro "Matz" Matsumoto 35be8b2524 Fixed the corner case bug in String#{gsub!,sub!}.
`"a".sub!("a", "a")` should not return `nil`.
2018-08-07 23:03:17 +09:00
Yukihiro "Matz" Matsumoto bbb0882343 Modifying frozen objects will raise FrozenError.
`FrozenError` is a subclass of `RuntimeError` which used to be
raised.  [Ruby2.5]
2017-12-12 18:41:18 +09:00
Yukihiro "Matz" Matsumoto 057be5ffb5 use unless instead of if not. 2017-06-21 11:13:33 +09:00
ksss 63c0044b11 Fix result if pattern is empty 2017-03-22 22:19:34 +09:00
ksss 7a74a617ea Callback should yield with pattern every time 2017-03-19 23:04:22 +09:00
ksss 67a6982710 Support to return Enumerator for String#gsub,gsub! 2017-03-19 22:45:14 +09:00
ksss 4ee79a8777 Support to return enumerator when no block given 2017-03-15 16:58:29 +09:00
ksss 673ce237c4 Suuport custom separator 2017-03-15 16:58:28 +09:00
ksss 6eb02a892d Use duplicated object for block args 2017-03-15 16:58:28 +09:00
Yukihiro "Matz" Matsumoto 7590482d48 Merge branch 'master' into string-gsub 2017-03-11 10:22:17 +09:00
ksss b56ad8d122 \1 sequences as empty strings 2017-03-10 22:22:06 +09:00
ksss 4b3e6cf169 Avoid infinity loop when empty string pattern 2017-03-10 13:26:15 +09:00
ksss eba4b1fd76 Check modifiable for String `bang' methods 2017-03-05 23:04:22 +09:00
Yukihiro "Matz" Matsumoto 1685eff2a5 Fixed off-by-one error in String#[]= with Ranges 2016-11-16 10:16:14 +09:00
Yukihiro "Matz" Matsumoto 92f72c7490 make String#[]= to take Ranges as position argument 2016-11-16 02:04:56 +09:00
Yukihiro "Matz" Matsumoto 418eec2c7d remove a comment that no longer be true; 2cb6c27 2015-09-23 00:01:39 +09:00
Yukihiro "Matz" Matsumoto 2cb6c27781 String#index should no longer take integer argument 2015-09-22 19:10:48 +09:00
takahashim f1c23a0f75 support String#[]= with 3 args 2015-09-16 18:50:03 +09:00
go.kikuta 11524f6f67 string.rb: refactor code (remove redundant code) 2015-08-21 14:54:01 +09:00
Jared Breeden 08c12ab7bf Don't crash if pattern not found for sub 2015-07-16 15:33:07 -07:00
Tomoyuki Sahara 5dd2b8e16f gsub/sub supports back references in substitutes. fixes #2816.
This implementation is compatible with CRuby's String#gsub/sub
except \1 ... \9 and \+.  They are useless without Regexp library.
2015-06-08 17:32:14 +09:00
Yukihiro "Matz" Matsumoto b05d736b49 update mrblib/*.rb files to conform (some of) Rubocop checks 2015-05-29 17:01:52 +09:00
Yukihiro "Matz" Matsumoto 8aba34301b String#[]= should support negative position; close #2707 2015-01-19 22:13:34 +09:00
takahashim bcceeba09b fix infinite loop in String#match(arg) when arg is String 2015-01-14 02:18:56 +09:00
Yukihiro "Matz" Matsumoto 4a2c37df93 made mrb_define_class to return existing class, with heavy refactoring 2014-02-08 13:44:31 +09:00
Tomoyuki Sahara 3b76aae4f0 fix ISO reference number of String#=~. 2014-01-10 12:01:24 +09:00
Yukihiro "Matz" Matsumoto 4d92d2e1aa string type check based on #to_str to encourage duck typing; #1616 2013-12-24 07:02:37 +09:00
h2so5 e137d1423d verify the argument of String#=~ 2013-12-24 00:09:34 +09:00
Yukihiro "Matz" Matsumoto 8d7e716158 String =~ and match to work with pluggable Regexp; close #1398 2013-07-23 20:22:15 +09:00
Yukihiro Matz Matsumoto b7da7cfee0 adopt String#gsub to fixed split behavior 2013-02-18 18:47:58 +09:00
Daniel Bovensiepen e8c0b61c0d String#gsub fix with last character 2013-02-17 12:13:46 +00:00
Yuichiro MASUI 0ee2c71b03 Added String#sub/sub! and String#gsub/gsub! 2013-02-12 16:10:35 +09:00
skandhas 8a43ec75a0 delete needless output in String#[]= 2012-11-02 14:58:21 +08:00
Yukihiro Matsumoto 57910ca535 String#each_byte to use String#bytes; close #508 2012-11-01 06:13:02 +09:00
Yukihiro Matsumoto 8f5017e768 raise NotImplementedError from regexp related string methods; close #319 2012-06-26 14:01:26 +09:00
Daniel Bovensiepen be20e99938 Add documentation to String 2012-05-03 16:43:44 +08:00
mimaki e0d6430f63 add mruby sources 2012-04-20 09:39:03 +09:00