Sha256: 870f4271c74742b936d64609c91df4f00dc91601eec51dee5f332bc17c35c5a5
Contents?: true
Size: 810 Bytes
Versions: 164
Compression:
Stored size: 810 Bytes
Contents
# frozen_string_literal: true module Motor module Configs module SyncFromFile MUTEXT = Mutex.new FILE_TIMESTAMPS_STORE = ActiveSupport::Cache::MemoryStore.new(size: 1.megabyte) module_function def call(with_exception: false) MUTEXT.synchronize do file = Pathname.new(Motor::Configs.file_path) file_timestamp = begin file.ctime rescue Errno::ENOENT raise if with_exception nil end next unless file_timestamp FILE_TIMESTAMPS_STORE.fetch(file_timestamp.to_s) do Motor::Configs::SyncFromHash.call( YAML.safe_load(file.read, permitted_classes: [Time, Date]) ) end end end end end end
Version data entries
164 entries across 164 versions & 7 rubygems