diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-09-19 22:01:28 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-09-19 22:02:46 +0900 |
| commit | b6c5e501b370e0758e9f1e224b2dd363df4f0998 (patch) | |
| tree | ba4cf27776838a6a4b45279e234ba233e5ac4358 /mrbgems/mruby-array-ext | |
| parent | 6d1728822d575812cbc0c5c3e181ac0031a75914 (diff) | |
| download | mruby-b6c5e501b370e0758e9f1e224b2dd363df4f0998.tar.gz mruby-b6c5e501b370e0758e9f1e224b2dd363df4f0998.zip | |
Removed `try_convert` method from Array and Hash.
Diffstat (limited to 'mrbgems/mruby-array-ext')
| -rw-r--r-- | mrbgems/mruby-array-ext/mrblib/array.rb | 25 | ||||
| -rw-r--r-- | mrbgems/mruby-array-ext/test/array.rb | 7 |
2 files changed, 0 insertions, 32 deletions
diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb index c0995bb99..7e8e792d4 100644 --- a/mrbgems/mruby-array-ext/mrblib/array.rb +++ b/mrbgems/mruby-array-ext/mrblib/array.rb @@ -1,31 +1,6 @@ class Array ## # call-seq: - # Array.try_convert(obj) -> array or nil - # - # Tries to convert +obj+ into an array, using +to_ary+ method. - # converted array or +nil+ if +obj+ cannot be converted for any reason. - # This method can be used to check if an argument is an array. - # - # Array.try_convert([1]) #=> [1] - # Array.try_convert("1") #=> nil - # - # if tmp = Array.try_convert(arg) - # # the argument is an array - # elsif tmp = String.try_convert(arg) - # # the argument is a string - # end - # - def self.try_convert(obj) - if obj.respond_to?(:to_ary) - obj.to_ary - else - nil - end - end - - ## - # call-seq: # ary.uniq! -> ary or nil # ary.uniq! { |item| ... } -> ary or nil # diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb index 4f54c65c3..2d2d181f8 100644 --- a/mrbgems/mruby-array-ext/test/array.rb +++ b/mrbgems/mruby-array-ext/test/array.rb @@ -1,13 +1,6 @@ ## # Array(Ext) Test -assert("Array.try_convert") do - assert_nil Array.try_convert(0) - assert_nil Array.try_convert(nil) - assert_equal [], Array.try_convert([]) - assert_equal [1,2,3], Array.try_convert([1,2,3]) -end - assert("Array#assoc") do s1 = [ "colors", "red", "blue", "green" ] s2 = [ "letters", "a", "b", "c" ] |
