File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,12 @@ def self.rb_big2ulong(val)
200
200
end
201
201
202
202
def self . rb_to_f ( val )
203
- rb_to_float ( val , :to_f ) ;
203
+ return val if object_kind_of? ( val , Float )
204
+ res = convert_type ( val , Float , :to_f , true )
205
+ unless object_kind_of? ( res , Float )
206
+ conversion_mismatch ( val , Float , :to_f , res )
207
+ end
208
+ res
204
209
end
205
210
206
211
def self . rb_to_int ( val )
@@ -212,15 +217,6 @@ def self.rb_to_int(val)
212
217
res
213
218
end
214
219
215
- def self . rb_to_float ( val , meth )
216
- return val if object_kind_of? ( val , Float )
217
- res = convert_type ( val , Float , meth , true )
218
- unless object_kind_of? ( res , Float )
219
- conversion_mismatch ( val , Float , meth , res )
220
- end
221
- res
222
- end
223
-
224
220
def self . conversion_mismatch ( val , cls , meth , res )
225
221
raise TypeError , "can't convert #{ object_class ( val ) } to #{ cls } (#{ object_class ( val ) } ##{ meth } gives #{ object_class ( res ) } )"
226
222
end
You can’t perform that action at this time.
0 commit comments