module Motor::Configs::SyncFromFile
Constants
- FILE_TIMESTAMPS_STORE
- MUTEXT
Public Instance Methods
call(with_exception: false)
click to toggle source
# File lib/motor/configs/sync_from_file.rb, line 11 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