Module: Otto::BaseHelpers
- Included in:
- RequestHelpers, ResponseHelpers
- Defined in:
- lib/otto/helpers/base.rb
Instance Method Summary collapse
-
#app_path(*paths) ⇒ String
Build application path by joining path segments.
Instance Method Details
#app_path(*paths) ⇒ String
Build application path by joining path segments
This method safely joins multiple path segments, handling duplicate slashes and ensuring proper path formatting. Includes the script name (mount point) as the first segment.
21 22 23 24 25 |
# File 'lib/otto/helpers/base.rb', line 21 def app_path(*paths) paths = paths.flatten.compact paths.unshift(env['SCRIPT_NAME']) if env['SCRIPT_NAME'] paths.join('/').gsub('//', '/') end |