summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-range-ext/mrblib
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-09-20 10:13:36 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-09-20 10:13:36 +0900
commit8e91316bd64aa39b3afeffb0ade5eb38b05d3953 (patch)
treefabce96f895417c6d2252860211aeb7b4df97a31 /mrbgems/mruby-range-ext/mrblib
parent3820ef791f3ccb766956d12534ae519f4923ac7e (diff)
parentcb85fa6787ea9467f81be41570a36b475b7ef061 (diff)
downloadmruby-8e91316bd64aa39b3afeffb0ade5eb38b05d3953.tar.gz
mruby-8e91316bd64aa39b3afeffb0ade5eb38b05d3953.zip
Merge branch 'no-implicit-conversion' into mruby2-draftmruby2-draft
Diffstat (limited to 'mrbgems/mruby-range-ext/mrblib')
-rw-r--r--mrbgems/mruby-range-ext/mrblib/range.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/mrbgems/mruby-range-ext/mrblib/range.rb b/mrbgems/mruby-range-ext/mrblib/range.rb
index e5d1fb079..de7925ba7 100644
--- a/mrbgems/mruby-range-ext/mrblib/range.rb
+++ b/mrbgems/mruby-range-ext/mrblib/range.rb
@@ -15,10 +15,7 @@ class Range
raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 1)" unless args.length == 1
nv = args[0]
- raise TypeError, "no implicit conversion from nil to integer" if nv.nil?
- raise TypeError, "no implicit conversion of #{nv.class} into Integer" unless nv.respond_to?(:to_int)
- n = nv.to_int
- raise TypeError, "no implicit conversion of #{nv.class} into Integer" unless n.kind_of?(Integer)
+ n = nv.__to_int
raise ArgumentError, "negative array size (or size too big)" unless 0 <= n
ary = []
each do |i|