class Borrower::Content

Public Class Methods

get(path) click to toggle source

take the contents of the file at the path @param [String] path @return [String] the contents

# File lib/borrower/content.rb, line 8
def get path
  path  = Borrower.find(path)
  obj = Item.new( path )

  return obj.content if obj.exists?

  raise "nothing exists at the provided path '#{path}'"
end
put(content, destination) click to toggle source
# File lib/borrower/content.rb, line 17
def put content, destination
  FileUtils.mkdir_p( File.dirname(destination) )
  File.open( destination, 'wb' ) do |file|
    file.write content
  end
end