1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00

Prefer explicit requires

Explicit requires have three advantages:

1. Allow us to add files without them being automatically
required. This may be useful for e.g. cleaner.rb
2. Enable static analysis in IDEs
3. Shave a few microseconds off of load time by eliminating
a few calls to the filesystem to list directories.
This commit is contained in:
Jared Beck 2016-04-09 01:15:51 -04:00
parent 3e7f5a1bfb
commit 886aa30aa0

View file

@ -1,14 +1,15 @@
require "request_store" require "request_store"
require "paper_trail/attributes_serialization"
# Require files in lib/paper_trail, but not its subdirectories. require "paper_trail/cleaner"
Dir[File.join(File.dirname(__FILE__), "paper_trail", "*.rb")].each do |file| require "paper_trail/config"
require File.join("paper_trail", File.basename(file, ".rb")) require "paper_trail/has_paper_trail"
end require "paper_trail/record_history"
require "paper_trail/reifier"
# Require serializers require "paper_trail/version_association_concern"
Dir[File.join(File.dirname(__FILE__), "paper_trail", "serializers", "*.rb")].each do |file| require "paper_trail/version_concern"
require File.join("paper_trail", "serializers", File.basename(file, ".rb")) require "paper_trail/version_number"
end require "paper_trail/serializers/json"
require "paper_trail/serializers/yaml"
module PaperTrail module PaperTrail
extend PaperTrail::Cleaner extend PaperTrail::Cleaner