diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-09-19 21:54:32 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-11-19 12:08:28 +0900 |
| commit | b5d43a16a38d522aa1d1d1a889585749a6b8086d (patch) | |
| tree | f216c0da801dd084fa3f0a72933d6d4ac1ff39ec /mrbgems/mruby-string-ext | |
| parent | ff08856fe314faa4d16b4502c0960a3475387846 (diff) | |
| download | mruby-b5d43a16a38d522aa1d1d1a889585749a6b8086d.tar.gz mruby-b5d43a16a38d522aa1d1d1a889585749a6b8086d.zip | |
Removed `String#try_convert` method from `mruby-string-ext` gem.
Because `try_convert` method rarely used in production. For mruby users,
we have `__to_str` utility method to check string type.
Diffstat (limited to 'mrbgems/mruby-string-ext')
| -rw-r--r-- | mrbgems/mruby-string-ext/mrblib/string.rb | 19 | ||||
| -rw-r--r-- | mrbgems/mruby-string-ext/test/string.rb | 7 |
2 files changed, 0 insertions, 26 deletions
diff --git a/mrbgems/mruby-string-ext/mrblib/string.rb b/mrbgems/mruby-string-ext/mrblib/string.rb index 9212d83a5..2a323c858 100644 --- a/mrbgems/mruby-string-ext/mrblib/string.rb +++ b/mrbgems/mruby-string-ext/mrblib/string.rb @@ -1,25 +1,6 @@ class String ## - # call-seq: - # String.try_convert(obj) -> string or nil - # - # Try to convert <i>obj</i> into a String, using to_str method. - # Returns converted string or nil if <i>obj</i> cannot be converted - # for any reason. - # - # String.try_convert("str") #=> "str" - # String.try_convert(/re/) #=> nil - # - def self.try_convert(obj) - if self === obj - obj - else - nil - end - end - - ## # call-seq: # string.clear -> string # diff --git a/mrbgems/mruby-string-ext/test/string.rb b/mrbgems/mruby-string-ext/test/string.rb index 4ccdfd6c3..7c96ab694 100644 --- a/mrbgems/mruby-string-ext/test/string.rb +++ b/mrbgems/mruby-string-ext/test/string.rb @@ -4,13 +4,6 @@ UTF8STRING = ("\343\201\202".size == 1) -assert('String.try_convert') do - assert_nil String.try_convert(nil) - assert_nil String.try_convert(:foo) - assert_equal "", String.try_convert("") - assert_equal "1,2,3", String.try_convert("1,2,3") -end - assert('String#getbyte') do str1 = "hello" bytes1 = [104, 101, 108, 108, 111] |
