outside of Java, I suppose
Re: YASNP (Yet Another Selector Namespace Proposal)
http://www.ruby-forum.com/topic/179060#786944
[quote="Yehuda Katz (wycats)"]
我真的很不懂 Java 串一堆 class 到底是所為何來?
我明白這樣彈性大,但弄個 wrapper 有那麼難嗎?
或許這裡也是吧。應該用:
Extlib::String.underscore_to_path_constantize(str)
當然問題就變成你要定義一堆 method. 或許:
Extlib::String.wrap(str).underscore.to_path.constantize.process
wrap 會把接下來的 method 做成 queue, 然後 process 時依序執行。
總之真的拜託就是不要輕易動到 core class :(
monkey patch is a dead end...
http://www.ruby-forum.com/topic/179060#786944
[quote="Yehuda Katz (wycats)"]
You end up needing to do:[/quote]
Extlib::String.constantize(Extlib::String.to_path(Extlib::String.underscore(str)))
instead of:
str.underscore.to_path.constantize
Honestly, we tried this in DataMapper for a while, but it
got too bulky to be realistic (outside of Java, I suppose).
-- Yehuda
我真的很不懂 Java 串一堆 class 到底是所為何來?
我明白這樣彈性大,但弄個 wrapper 有那麼難嗎?
或許這裡也是吧。應該用:
Extlib::String.underscore_to_path_constantize(str)
當然問題就變成你要定義一堆 method. 或許:
Extlib::String.wrap(str).underscore.to_path.constantize.process
wrap 會把接下來的 method 做成 queue, 然後 process 時依序執行。
總之真的拜託就是不要輕易動到 core class :(
monkey patch is a dead end...
0 retries:
Post a Comment
Note: Only a member of this blog may post a comment.