Class: URI::File
- Inherits:
-
Generic
- Object
- Generic
- URI::File
- Defined in:
- lib/json-schema/uri/file.rb
Overview
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
Constant Summary collapse
- COMPONENT =
[ :scheme, :path, :fragment, :host ].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*arg) ⇒ File
constructor
A new instance of File.
- #open(*rest, &block) ⇒ Object
Constructor Details
#initialize(*arg) ⇒ File
Returns a new instance of File.
17 18 19 20 21 22 23 |
# File 'lib/json-schema/uri/file.rb', line 17 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 |
Class Method Details
.build(args) ⇒ Object
25 26 27 28 |
# File 'lib/json-schema/uri/file.rb', line 25 def self.build(args) tmp = Util::make_components_hash(self, args) return super(tmp) end |
Instance Method Details
#open(*rest, &block) ⇒ Object
30 31 32 |
# File 'lib/json-schema/uri/file.rb', line 30 def open(*rest, &block) ::File.open(self.path, *rest, &block) end |