Skip to content

Commit

Permalink
make data loading thread safe
Browse files Browse the repository at this point in the history
  • Loading branch information
bdurand committed Aug 23, 2024
1 parent 67a4072 commit e8c1489
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.2.3

### Fixed

- Made loading data from the data files thread safe.

## 1.2.2

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.2
1.2.3
3 changes: 2 additions & 1 deletion lib/support_table_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ def support_table_classes(*extra_classes)
# Eager load any classes defined in the default data directory by guessing class names
# from the file names.
if SupportTableData.data_directory && File.exist?(SupportTableData.data_directory) && File.directory?(SupportTableData.data_directory)
Dir.chdir(SupportTableData.data_directory) { Dir.glob(File.join("**", "*")) }.each do |file_name|
Dir.glob(File.join(SupportTableData.data_directory, "**", "*")).sort.each do |file_name|
file_name = file_name.delete_prefix("#{SupportTableData.data_directory}#{File::SEPARATOR}")
class_name = file_name.sub(/\.[^.]*/, "").singularize.camelize
class_name.safe_constantize
end
Expand Down

0 comments on commit e8c1489

Please sign in to comment.