class Gemirro::MirrorFile
Similar to {Gemirro::MirrorDirectory} the MirrorFile
class is used to make it easier to read and write data in a directory that mirrors data from an external source.
@!attribute [r] path
@return [String]
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
@param [String] path
# File lib/gemirro/mirror_file.rb, line 18 def initialize(path) @path = path end
Public Instance Methods
read()
click to toggle source
Reads the content of the current file.
@return [String]
# File lib/gemirro/mirror_file.rb, line 40 def read handle = File.open(@path, 'r') content = handle.read handle.close content end
write(content)
click to toggle source
Writes the specified content to the current file. Existing files are overwritten.
@param [String] content
# File lib/gemirro/mirror_file.rb, line 28 def write(content) handle = File.open(@path, 'w') handle.write(content) handle.close end