Sha256: d4ff895d2e51283185952a772fcaa48b9a4bac4457accc75f2e25882862f8fad
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 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 extend Support::Configurable class << self def entry_group_file_exists?(time:) File.exist?(entry_group_file_path(time: time)) end def entry_group_file_path(time:) File.join(entries_folder, entries_file_name(time: time)) end def entries_folder configuration[:entries_folder] end def entries_file_name(time:) time.strftime(configuration[:entries_file_name]) end # def configuration # Services::ConfigurationLoaderService.new.call # end end def entry_group_file_exists? EntryGroupFileable.entry_group_file_exists?(time: time) end def entry_group_path_exists? Dir.exist?(entries_folder) end def entry_group_file_path EntryGroupFileable.entry_group_file_path(time: time) end def entries_folder @entries_folder ||= EntryGroupFileable.entries_folder end def entries_file_name @entries_file_name ||= EntryGroupFileable.entries_file_name(time: time) end def create_entry_group_path_if! FileUtils.mkdir_p(entries_folder) unless entry_group_path_exists? end private def configuration @configuration ||= options[:configuration] || EntryGroupFileable.configuration end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dsu-1.1.1 | lib/dsu/support/entry_group_fileable.rb |
dsu-1.1.0.alpha.2 | lib/dsu/support/entry_group_fileable.rb |
dsu-1.1.0.alpha.1 | lib/dsu/support/entry_group_fileable.rb |