Sha256: ff3299236234549e0b0e2d51a7c81ebd0b4083cfbce78f0589acafe4c81efcff
Contents?: true
Size: 859 Bytes
Versions: 16
Compression:
Stored size: 859 Bytes
Contents
require 'rbconfig' require 'uri' module URI # Ruby does not have built-in support for filesystem URIs, and definitely does not have built-in support for # using open-uri with filesystem URIs class File < Generic COMPONENT = [ :scheme, :path, :fragment, :host ].freeze def initialize(*arg) # arg[2] is the 'host'; this logic to set it to "" causes file schemes with UNC to break # so don't do it on windows platforms is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) arg[2] = "" unless is_windows super(*arg) end def self.build(args) tmp = Util::make_components_hash(self, args) return super(tmp) end def open(*rest, &block) ::File.open(self.path, *rest, &block) end @@schemes['FILE'] = File end end
Version data entries
16 entries across 16 versions & 2 rubygems