class FileHandler
Handles the Reading and writing of files
Public Instance Methods
content(plmat)
click to toggle source
Retrieves the content as text of a file
Arguments:
* plmat (File) - a .plmat file in .plmat markdown
Return:
* (String) - contents of .plmat file
# File lib/placemat.rb, line 16 def content(plmat) file = File.open(plmat, "rb") file.read end
output(contents, filename = "output.html")
click to toggle source
Creates or overwrites text to a new file
Arguments:
* contents (String) - string of text to write to file * filename (String) - name for new file, defaults to output.html if not specified
# File lib/placemat.rb, line 27 def output(contents, filename = "output.html") out_file = File.new(filename, "w") out_file.puts(contents) out_file.close end