About

Installation

  • Prerelease: gem install media-path --prerelease
  • Stable Version: gem install media-path

Setup


MediaMediaPath.media_root = "public"

Rewriting rules


MediaMediaPath.rewrite { |path| "http://media.domain.org/#{path}" }
MediaMediaPath.rewrite { |path| path.tr("_", "-") }

Usage


path = MediaMediaPath.new("public/javascripts/mootools-core.js")

path.relative
# => "public/javascripts/mootools-core.js"

path.absolute
# => "/Users/botanicus/projects/webs/myproject/public/javascripts/mootools-core.js"

path.server
# => "/javascripts/mootools-core.js"

Links

- Source Code - RunCodeRun - API Documentation