defined?の挙動

e$B$k$S$-$A$G$9!#e(B

defined?e$B$N5sF0$K$D$$$F5$$K$J$j$^$9!#e(B

class Object
def p1
p self; self
end
alias p2 p1
end

defined? 1.p1 # => method
defined? 2.p1.p2 # => method
defined? [10].each # => method
defined? [20].each{|x| p x} # => expression

>> 2

>> 20

e$B!Ve(Bdefined?
2.p1.p2e$B!W$N>l9g!"!Ve(B2.p1e$B!W$,I>2A$5$l$k$N$O;EMM$G$9$+!)e(B

e$B$^$?!"%V%m%C%/IU$-%a%=%C%I8F$S=P$7$Oe(B"method"e$B$G$O$J$/$Fe(B"expression"e$B$K$J$j$^$9!#e(B
e$B$7$+$b<0$=$N$b$N$rI>2A$7$F$$$^$9!#$3$l$O0U?^$7$?;EMM$G$9$+!)e(B

Ruby 1.8e$B!"e(BRuby 1.9e$BAPJ}$G$bF1$87k2L$G$9!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs