class Dropdown::OutputStores::FileStore

Attributes

path[R]

Public Class Methods

new(output_path) click to toggle source
# File lib/dropdown/output_stores/file_store.rb, line 6
def initialize(output_path)
  @output_path = output_path
end

Public Instance Methods

save(contents, file_name) click to toggle source
# File lib/dropdown/output_stores/file_store.rb, line 10
def save(contents, file_name)
  create_directory @output_path
  @path = "#{@output_path}/#{file_name}"
  File.open(@path, 'w+') { |f| f.write contents }
end

Private Instance Methods

create_directory(path) click to toggle source
# File lib/dropdown/output_stores/file_store.rb, line 18
def create_directory(path)
  FileUtils.mkdir_p(path)
end