Sha256: 9454bed780feab547bba0d2e45bf97bcc1cbe169185e55bd2512db8d99f29977

Contents?: true

Size: 464 Bytes

Versions: 3

Compression:

Stored size: 464 Bytes

Contents

require "fileutils"
require "date"

module DailyWeeklyMonthly
  class Creator
    def initialize backup, backups_dir, output_extension
      @backup = backup
      @backups_dir = backups_dir
      @output_extension = output_extension
    end

    def call dir
      FileUtils.mkdir_p File.join(@backups_dir, dir)
      output_path = File.join(@backups_dir, dir, "#{Date.today.iso8601}.#{@output_extension}")
      File.write output_path, @backup
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
daily_weekly_monthly-0.0.4 lib/daily_weekly_monthly/creator.rb
daily_weekly_monthly-0.0.3 lib/daily_weekly_monthly/creator.rb
daily_weekly_monthly-0.0.2 lib/daily_weekly_monthly/creator.rb