Class: Bootscale::CacheBuilder
- Inherits:
-
Object
- Object
- Bootscale::CacheBuilder
- Defined in:
- lib/bootscale/cache_builder.rb
Instance Method Summary collapse
-
#generate(load_path) ⇒ Object
generate the requireables cache from all current load-path entries each load-path is cached individually, so new ones can be added or removed but added/removed files will not be discovered.
-
#initialize ⇒ CacheBuilder
constructor
A new instance of CacheBuilder.
Constructor Details
#initialize ⇒ CacheBuilder
Returns a new instance of CacheBuilder.
3 4 5 |
# File 'lib/bootscale/cache_builder.rb', line 3 def initialize @entries = {} end |
Instance Method Details
#generate(load_path) ⇒ Object
generate the requireables cache from all current load-path entries each load-path is cached individually, so new ones can be added or removed but added/removed files will not be discovered
10 11 12 13 14 15 16 |
# File 'lib/bootscale/cache_builder.rb', line 10 def generate(load_path) requireables = load_path.reverse_each.flat_map do |path| path = path.to_s entries[path] ||= Entry.new(path).requireables end Hash[requireables] end |