Sha256: 91786bf892af8f3629f4dd5ea3f68ab1e6d87913cf18881f8b4e75983add6ee5

Contents?: true

Size: 514 Bytes

Versions: 10

Compression:

Stored size: 514 Bytes

Contents

module Steep
  module PathHelper
    module_function

    def to_pathname(uri, dosish: Gem.win_platform?)
      uri = URI.parse(uri)
      if uri.scheme == "file"
        path = uri.path or raise
        path.sub!(%r{^/([a-zA-Z])(:|%3A)//?}i, '\1:/') if dosish
        Pathname(path)
      end
    end

    def to_uri(path, dosish: Gem.win_platform?)
      str_path = path.to_s
      if dosish
        str_path.insert(0, "/") if str_path[0] != "/"
      end
      URI::File.build(path: str_path)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
steep-1.3.2 lib/steep/path_helper.rb
steep-1.3.1 lib/steep/path_helper.rb
steep-1.4.0.dev.2 lib/steep/path_helper.rb
steep-1.4.0.dev.1 lib/steep/path_helper.rb
steep-1.3.0 lib/steep/path_helper.rb
steep-1.3.0.pre.2 lib/steep/path_helper.rb
steep-1.3.0.pre.1 lib/steep/path_helper.rb
steep-1.2.1 lib/steep/path_helper.rb
steep-1.2.0 lib/steep/path_helper.rb
steep-1.2.0.pre.1 lib/steep/path_helper.rb