Class: String
Instance Method Summary collapse
-
#/(child) ⇒ Pathname
Constructs a Pathname from the String, and appends
child
to the Pathname. -
#append_to_file(file) ⇒ self
Appends the String to the specified
file
. -
#to_pathname ⇒ Pathname
(also: #path)
Constructs a Pathname from the String.
-
#write_to_file(file) ⇒ self
Writes the String to the specified
file
, overwriting the file if it exists.
Instance Method Details
#/(child) ⇒ Pathname
Constructs a Pathname from the String, and appends child
to the Pathname.
26 27 28 |
# File 'lib/pleasant_path/string.rb', line 26 def /(child) self.path / child end |
#append_to_file(file) ⇒ self
Appends the String to the specified file
. Creates the file if it does not exist, including any necessary parent directories. Returns the String.
61 62 63 64 |
# File 'lib/pleasant_path/string.rb', line 61 def append_to_file(file) file.to_pathname.append_text(self) self end |
#to_pathname ⇒ Pathname Also known as: path
Constructs a Pathname from the String.
9 10 11 |
# File 'lib/pleasant_path/string.rb', line 9 def to_pathname Pathname.new(self) end |
#write_to_file(file) ⇒ self
Writes the String to the specified file
, overwriting the file if it exists. Creates the file if it does not exist, including any necessary parent directories. Returns the String.
42 43 44 45 |
# File 'lib/pleasant_path/string.rb', line 42 def write_to_file(file) file.to_pathname.write_text(self) self end |