Module: SassC::Util
- Defined in:
- lib/sassc/embedded.rb
Constant Summary collapse
- URI_PARSER =
URI::Parser.new({ RESERVED: ';/?:@&=+$,' })
Class Method Summary collapse
Class Method Details
.file_url_to_path(url) ⇒ Object
403 404 405 406 407 408 409 |
# File 'lib/sassc/embedded.rb', line 403 def file_url_to_path(url) return if url.nil? path = URI_PARSER.unescape(URI.parse(url).path) path = path[1..] if Gem.win_platform? && path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':' path end |
.path_to_file_url(path) ⇒ Object
411 412 413 414 415 416 417 |
# File 'lib/sassc/embedded.rb', line 411 def path_to_file_url(path) return if path.nil? path = File.absolute_path(path) path = "/#{path}" unless path.start_with? '/' URI::File.build([nil, URI_PARSER.escape(path)]).to_s end |