Class: Path::URI
Overview
A wrapper for URI objects.
Constant Summary
Constants inherited from Path
AUTOGENERATED_CLASS_METHODS, BINARY_EXTENSION, COMPRESSORS, PATH_SEPARATOR, URI_RE
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Attributes inherited from Path
Instance Method Summary collapse
-
#host ⇒ Object
…and this is: ‘host.com’.
-
#http? ⇒ Boolean
‘http?` checks for ’http’ OR ‘https’ schemes.
-
#initialize(uri, **hints) ⇒ URI
constructor
TODO: only include certain methods from Path (delegate style) (eg: remove commands that write).
- #inspect ⇒ Object
- #join(other) ⇒ Object
-
#open(mode = "r", &block) ⇒ Object
(also: #io)
…and ‘path` is /path/filename.ext.
-
#port ⇒ Object
…and this is: 80.
-
#query ⇒ Object
…and this is: {param1: value1, param2: value2, …etc… }.
- #read(*args) ⇒ Object
- #scheme ⇒ Object (also: #protocol)
- #to_path ⇒ Object
-
#to_s ⇒ Object
Example:.
- #to_str ⇒ Object
- #uri? ⇒ Boolean
Methods inherited from Path
#/, #<=>, #==, #=~, [], #[], #[]=, #append, #atime, #atime=, #attrs, #attrs=, #backup!, #backup_file, #broken_symlink?, cd, #cd, #child_of?, #chmod, #chmod_R, #chown, #chown_R, #cp, #cp_p, #cp_r, #ctime, #deflate, #dir, #dir=, #dir?, #each_chunk, #each_line, #endswith, escape, #executable?, #exists?, expand_path, #exts, #file?, #filename, #filename=, getfattr, glob, #grep, #gunzip!, #gzip!, #hash, #hidden?, home, #id3, #inflate, #initialize_copy, #ln_s, ln_s, ls, #ls, #ls_R, #ls_dirs, #ls_files, #ls_r, ls_r, #lstat, #magic, #md5, #mimetype, #mimetype_from_ext, #mkcd, mkcd, #mode, #mtime, #mtime=, #mv, #mv!, #name, new, #numbered_backup!, #numbered_backup_file, #owner?, #parent, #parent_of?, #parse, #parse_lines, #path, #path=, popd, pushd, #puts, pwd, #read_bson, #read_csv, #read_html, #read_json, #read_marshal, #read_xml, #read_yaml, #readable?, #realpath, #relative, #relative?, #relative_to, #reload!, #rename, #rename!, #reset!, #rm, setfattr, #sha1, #sha2, #sha256, #siblings, #size, #sort_attrs, #startswith, #symlink?, #symlink_target, #symlink_to, tmpdir, tmpfile, #to_Path, #touch, #truncate, #type, #unmarshal, #update, #url?, which, #writable?, #write, #write_bson, #write_json, #write_marshal, #write_yaml, zopen, #zopen
Methods included from Enumerable
#*, #**, #average, #blank?, #combination, #counts, #cross_product, #foldl, #group_neighbours_by, #grouped_to_h, #groups, #map_recursively, #parallel_map, #permutation, #powerset, #reverse, #reverse_each, #rle, #rzip, #select_recursively, #skip, #sort_numerically, #split_after, #split_at, #split_before, #split_between, #sum, #to_iter, #uniq, #unzip
Methods included from Array::ToCSV
Constructor Details
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
1645 1646 1647 |
# File 'lib/epitools/path.rb', line 1645 def uri @uri end |
Instance Method Details
#host ⇒ Object
…and this is: ‘host.com’
1692 |
# File 'lib/epitools/path.rb', line 1692 def host; uri.host; end |
#http? ⇒ Boolean
‘http?` checks for ’http’ OR ‘https’ schemes
1685 1686 1687 |
# File 'lib/epitools/path.rb', line 1685 def http? super or https? end |
#inspect ⇒ Object
1669 1670 1671 |
# File 'lib/epitools/path.rb', line 1669 def inspect "#<Path::URI:#{to_s}>" end |
#join(other) ⇒ Object
1710 1711 1712 |
# File 'lib/epitools/path.rb', line 1710 def join(other) Path.new URI.join(path, other).to_s end |
#open(mode = "r", &block) ⇒ Object Also known as: io
…and ‘path` is /path/filename.ext
1717 1718 1719 1720 1721 1722 1723 1724 |
# File 'lib/epitools/path.rb', line 1717 def open(mode="r", &block) require 'open-uri' if block_given? ::URI.open(to_s, mode, &block) else ::URI.open(to_s, mode) end end |
#port ⇒ Object
…and this is: 80
1697 |
# File 'lib/epitools/path.rb', line 1697 def port; uri.port; end |
#query ⇒ Object
…and this is: {param1: value1, param2: value2, …etc… }
1702 1703 1704 1705 1706 1707 1708 |
# File 'lib/epitools/path.rb', line 1702 def query if query = uri.query query.to_params else nil end end |
#read(*args) ⇒ Object
1728 1729 1730 |
# File 'lib/epitools/path.rb', line 1728 def read(*args) open { |io| io.read(*args) } end |
#scheme ⇒ Object Also known as: protocol
1673 1674 1675 |
# File 'lib/epitools/path.rb', line 1673 def scheme uri.scheme end |
#to_path ⇒ Object
1666 |
# File 'lib/epitools/path.rb', line 1666 def to_path; to_s; end |
#to_s ⇒ Object
Example:
When this is: host.com:port/path/filename.ext?param1=value1¶m2=value2&…
1665 |
# File 'lib/epitools/path.rb', line 1665 def to_s; uri.to_s; end |
#to_str ⇒ Object
1667 |
# File 'lib/epitools/path.rb', line 1667 def to_str; to_s; end |
#uri? ⇒ Boolean
1656 1657 1658 |
# File 'lib/epitools/path.rb', line 1656 def uri? true end |