class Daily::Txt::PathBuilder
Constants
- DEFAULT_EXT
- DIR_TEXT
Public Class Methods
by_date(root, date)
click to toggle source
# File lib/daily/txt/path_builder.rb, line 22 def by_date(root, date) File.join(root, DIR_TEXT, "%04d" % date.year, "%02d" % date.month, filename(date)) end
filename(date)
click to toggle source
# File lib/daily/txt/path_builder.rb, line 11 def filename(date) "%04d_%02d_%02d.%s" % [date.year, date.month, date.day, DEFAULT_EXT] end
prepare_basedir(path)
click to toggle source
# File lib/daily/txt/path_builder.rb, line 15 def prepare_basedir(path) dir = File.dirname(path) unless Dir.exist?(dir) FileUtils.mkdir_p(dir) end end