Sha256: e3213ff02a61f4ac3c69481af56478db79aa05314ffaad7e3d0792958279a610
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require_relative '../services/configuration_loader_service' require_relative '../support/configurable' module Dsu module Support # TODO: I hate this module; refactor it!!! # This module expects the following attributes to be defined: :time, :options module EntryGroupFileable include Support::Configurable def entry_group_file_exists? File.exist?(entry_group_file_path) end def entry_group_file_exists_for?(time:) entries_file_name = time.strftime(configuration_or_options_configuration[:entries_file_name]) File.join(entries_folder, entries_file_name) end private def entry_group_path_exists? Dir.exist?(entries_folder) end def entry_group_file_path File.join(entries_folder, entries_file_name) end def entries_folder @entries_folder ||= configuration_or_options_configuration[:entries_folder] end def entries_file_name @entries_file_name ||= time.strftime(configuration_or_options_configuration[:entries_file_name]) end def create_entry_group_path_if! FileUtils.mkdir_p(entries_folder) unless entry_group_path_exists? end def configuration_or_options_configuration @configuration_or_options_configuration ||= options[:configuration] || configuration end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dsu-1.2.1 | lib/dsu/support/entry_group_fileable.rb |