Module: Eco::Data::Files::Timestamp

Included in:
ClassMethods
Defined in:
lib/eco/data/files/timestamp.rb

Constant Summary collapse

DEFAULT_TIMESTAMP =
'%Y-%m-%dT%H%M%S'.freeze

Instance Method Summary collapse

Instance Method Details

#timestamp(timestamp_pattern = DEFAULT_TIMESTAMP, date = Time.now) ⇒ Object



7
8
9
# File 'lib/eco/data/files/timestamp.rb', line 7

def timestamp(timestamp_pattern = DEFAULT_TIMESTAMP, date = Time.now)
  date.strftime(timestamp_pattern)
end

#timestamp_file(filename, timestamp_pattern = DEFAULT_TIMESTAMP) ⇒ Object



11
12
13
14
# File 'lib/eco/data/files/timestamp.rb', line 11

def timestamp_file(filename, timestamp_pattern = DEFAULT_TIMESTAMP)
  file_pattern = Eco::Data::Files::FilePattern.new(filename)
  file_pattern.resolve(start: "#{timestamp(timestamp_pattern)}_")
end