File: string.rb

package info (click to toggle)
ruby-filepath 0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 244 kB
  • sloc: ruby: 1,691; makefile: 5
file content (21 lines) | stat: -rw-r--r-- 486 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# This is free software released into the public domain (CC0 license).


class String
	# Generates a path from a String.
	#
	# `"/a/b/c".as_path` is equivalent to `Filepath.new("/a/b/c")`.
	#
	# @example Filepath from a string
	#
	#     "/etc/ssl/certs".as_path #=> </etc/ssl/certs>
	#
	# @return [Filepath] a new path generated from the string
	#
	# @note FIXME: `#as_path` should be `#to_path` but that method name
	#       is already used

	def as_path
		Filepath.new(self)
	end
end