summaryrefslogtreecommitdiff
path: root/vendor/bundle/ruby/3.4.0/gems/sass-embedded-1.101.0-arm64-darwin/lib/sass/uri.rb
diff options
context:
space:
mode:
authorBen Sanders <ben@sanders.life>2026-08-02 09:49:25 -0400
committerBen Sanders <ben@sanders.life>2026-08-02 09:49:25 -0400
commitb41479c91e6685511c1f8ba8586106b322073b62 (patch)
treec9f1345999d754ae0a533849966427e792d9e68d /vendor/bundle/ruby/3.4.0/gems/sass-embedded-1.101.0-arm64-darwin/lib/sass/uri.rb
parentcfaceeb9a6d1295f5754be211858155cd309acc2 (diff)
added statscounter code
Diffstat (limited to 'vendor/bundle/ruby/3.4.0/gems/sass-embedded-1.101.0-arm64-darwin/lib/sass/uri.rb')
-rw-r--r--vendor/bundle/ruby/3.4.0/gems/sass-embedded-1.101.0-arm64-darwin/lib/sass/uri.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/vendor/bundle/ruby/3.4.0/gems/sass-embedded-1.101.0-arm64-darwin/lib/sass/uri.rb b/vendor/bundle/ruby/3.4.0/gems/sass-embedded-1.101.0-arm64-darwin/lib/sass/uri.rb
new file mode 100644
index 0000000..2e0f9b9
--- /dev/null
+++ b/vendor/bundle/ruby/3.4.0/gems/sass-embedded-1.101.0-arm64-darwin/lib/sass/uri.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+require 'uri'
+
+module Sass
+ # The {Uri} class.
+ #
+ # It follows RFC3986 to match the behavior of Uri class from Dart.
+ #
+ # @see https://www.rfc-editor.org/info/rfc3986/
+ module Uri
+ module_function
+
+ def decode_uri_component(str)
+ str.b.gsub(/%\h\h/, ::URI::TBLDECWWWCOMP_).force_encoding(str.encoding)
+ end
+
+ def encode_uri_component(str)
+ str.b.gsub(/[^0-9A-Za-z\-._~]/n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
+ end
+
+ def encode_uri_path_component(str)
+ str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/]}n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
+ end
+
+ def encode_uri_query_component(str)
+ str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/?]}n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
+ end
+
+ def file_uri_to_path(uri)
+ path = decode_uri_component(::URI::RFC3986_PARSER.parse(uri).path)
+ if path.start_with?('/')
+ windows_path = path[1..]
+ path = windows_path if File.absolute_path?(windows_path)
+ end
+ path
+ end
+
+ def path_to_file_uri(path)
+ path = "/#{path}" unless path.start_with?('/')
+ "file://#{encode_uri_path_component(path)}"
+ end
+
+ def pwd
+ pwd = Dir.pwd
+ pwd += '/' unless pwd.end_with?('/')
+ path_to_file_uri(pwd)
+ end
+
+ def relative(to, from)
+ ::URI::RFC3986_PARSER.parse(to).route_from(from).to_s
+ end
+ end
+
+ private_constant :Uri
+end