【发布时间】:2011-12-12 07:00:35
【问题描述】:
谁能帮我解释一下来自 Lucky Stiff 的 Camping 微框架的这部分代码:
# Simply builds a complete path from a path +p+ within the app. If your
# application is mounted at <tt>/blog</tt>:
#
# self / "/view/1" #=> "/blog/view/1"
# self / "styles.css" #=> "styles.css"
# self / R(Edit, 1) #=> "/blog/edit/1"
#
def /(p); p[0] == ?/ ? @root + p : p end
【问题讨论】: