What have you found for these years?

2009-05-18

ruby stomp

寫得也有點太莫名其妙了一點吧...
很想睡的狀況下看半天才忽然意會他想做什麼

s = @socket
do something if s.nil?
@socket = s
return s

.....
為什麼不寫

return @socket if @socket
@socket = do something
return @socket

尤其那個 do something 又那麼長,害我以為他是不斷重複連線...
而且這樣如果 @socket 存在的話,變成

s = @socket
@socket = s
return s

整個不知道在幹嘛... 而且裡面怎麼好幾個看起來意思差不多的 method?

new/open 等價,但不是 alias

__old_receive
receive
_receive( s )

這這... dirty hack??

0 retries:

Post a Comment

Note: Only a member of this blog may post a comment.



All texts are licensed under CC Attribution 3.0