Invalid value for


#1

e$B0J2<$N$h$&$Ke(B Integer() e$B$He(B Float()
e$B$G%(%i!<$N%a%C%;!<%8$,HyL/$K0c$$$^$9e(B
e$B$,e(B
(e$B3g8L$,$"$k$+$I$&$+e(B)e$B!"$G$-$l$PB7$($?$$$H;W$$$^$9$,!"$I$C$A$,$$$$$G$7$ge(B
e$B$&$+e(B?

main@191-20081228> Integer(‘foo’)
ArgumentError: invalid value for Integer: “foo”

main@191-20081228> Float(‘foo’)
ArgumentError: invalid value for Float(): “foo”


#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:37632] invalid value for”
on Sun, 28 Dec 2008 21:56:19 +0900, Tadayoshi F.
removed_email_address@domain.invalid writes:

|e$B0J2<$N$h$&$Ke(B Integer() e$B$He(B Float() e$B$G%(%i!<$N%a%C%;!<%8$,HyL/$K0c$$$^$9e(B
|e$B$,e(B (e$B3g8L$,$"$k$+$I$&$+e(B)e$B!"$G$-$l$PB7$($?$$$H;W$$$^$9$,!"$I$C$A$,$$$$$G$7$ge(B
|e$B$&$+e(B?
|
|main@191-20081228> Integer(‘foo’)
|ArgumentError: invalid value for Integer: “foo”
|
|main@191-20081228> Float(‘foo’)
|ArgumentError: invalid value for Float(): “foo”

e$B3g8L$,$"$kJ}$K0lI<!#e(B


#3

e$B9bHx9(<#$G$9!#e(B

On 2008/12/28, at 21:56, Tadayoshi F. wrote:

e$B0J2<$N$h$&$Ke(B Integer() e$B$He(B Float() e$B$G%(%i!<$N%a%C%;!<%8$,HyL/$K0c$$$^$9e(B
e$B$,e(B (e$B3g8L$,$"$k$+$I$&$+e(B)e$B!"$G$-$l$PB7$($?$$$H;W$$$^$9$,!"$I$C$A$,$$$$$G$7$ge(B
e$B$&$+e(B?

main@191-20081228> Integer(‘foo’)
ArgumentError: invalid value for Integer: “foo”

main@191-20081228> Float(‘foo’)
ArgumentError: invalid value for Float(): “foo”

e$B%P%C%/%H%l!<%9$Ke(B Integer() e$B$de(B Float()
e$B$N%a%=%C%IL>$,4^$^$l$k;v$+$i!“e(B
e$B%a%=%C%IL>$r>J$-!”!Ve(Binvalid value:
"foo"e$B!W$H$$$&$N$O$$$+$,$G$7$g$&$+!#e(B


#4

e$B?\F#$G$9!#e(B

In removed_email_address@domain.invalid
“[ruby-dev:37638] Re: invalid value for” on Mon, 29 Dec 2008 12:03:04
+0900,
Takao K. removed_email_address@domain.invalid wrote:

e$B%P%C%/%H%l!<%9$Ke(B Integer() e$B$de(B Float() e$B$N%a%=%C%IL>$,4^$^$l$k;v$+$i!“e(B
e$B%a%=%C%IL>$r>J$-!”!Ve(Binvalid value: "foo"e$B!W$H$$$&$N$O$$$+$,$G$7$g$&$+!#e(B

e$B8D?ME*$K$O!"$J$<$I$s$JLdBj$,5/$-$F!"$I$&$9$l$PD>$;$=$&$+$H$$e(B
e$B$&>pJs$O$G$-$k$@$1%P%C%/%H%l!<%9L5$7$G$b$o$+$C$?J}$,4r$7$$$Ge(B
e$B$9!#e(B

e$B$J$N$G!"e(B

  • ArgumentError: invalid integer value: “foo”
  • ArgumentError: invalid float value: “foo”
    e$B$H$+!"e(B
  • InvalidIntegerError: invalid value: “foo”
  • InvalidFloatError: invalid value: “foo”
    e$B$N$h$&$JJ}$,8D?ME*$K$O9%$_$G$9!#e(B

e$B$"$j$=$&$N$J$$Nc$G$9$,!#!#!#e(B

GUIe$B$rMxMQ$7$F$$$k$H$-$O!“I=<(>l=j$N9-$5$NET9g$J$I$G%P%C%/%He(B
e$B%l!<%9$r8+$l$J$$$3$H$b$”$k$+$b$7$l$^$;$s!#e(B

aliase$B$r$7$F$$$k$He(BIntegere$B$H$+$,%P%C%/%H%l!<%9$+$i8+$($J$/$J$je(B
e$B$^$9!#e(B
alias convert_to_integer_with_validation Integer


#5

e$B%P%C%/%H%l!<%9$J$7$G$b!"$H$$$&$N$O!"$?$7$+$K$=$&$J$N$+$b$7$l$J$$$G$9$,!"e(B
e$B<B:]$H$3$me(B ruby
e$B$G$O$=$l$J$7$G$OBg$7$?>pJs$,F@$i$l$J$$$N$G$9$h$M!#e(B

rb_Integer e$B$de(B rb_Float
e$B$O2<@A$1$G$b$D$+$o$l$F$$$F!"$=$&$$$&>l9g$N%(%i!<e(B
e$BI=<($H$7$FI,MW$J$N$+!"$`$7$mITMW$J$N$+!"$H$$$&$N$b9M$($I$3$m$G$9$+$M!#e(B

e$B$^$D$b$H$5$s$"$?$j$+$i9M$(D>$9$H$$$&OC$G$b$J$1$l$P!"$H$j$"$($:3g8L$r$De(B
e$B$1$k$h$&$KE}0l$7$h$&$H;W$$$^$9!#e(B