Class: Stashify::File::Local
Overview
An implementation for interacting with local files. The constructor needs no information on top of what is included #initialize, although it’s important to note that setting the contents parameter will not do anything.
Instance Attribute Summary
#name, #path
Instance Method Summary
collapse
#==, #initialize
Constructor Details
This class inherits a constructor from Stashify::File
Instance Method Details
permalink
#contents ⇒ Object
[View source]
12
13
14
|
# File 'lib/stashify/file/local.rb', line 12
def contents
::File.read(path)
end
|
[View source]
20
21
22
|
# File 'lib/stashify/file/local.rb', line 20
def delete
::File.delete(path)
end
|
permalink
#exists? ⇒ Boolean
[View source]
24
25
26
|
# File 'lib/stashify/file/local.rb', line 24
def exists?
::File.exist?(path)
end
|
permalink
#write(contents) ⇒ Object
[View source]
16
17
18
|
# File 'lib/stashify/file/local.rb', line 16
def write(contents)
::File.write(path, contents)
end
|