Class: Bootscale::CacheBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/bootscale/cache_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCacheBuilder

Returns a new instance of CacheBuilder.



5
6
7
# File 'lib/bootscale/cache_builder.rb', line 5

def initialize
  @entries = {}
end

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries.



3
4
5
# File 'lib/bootscale/cache_builder.rb', line 3

def entries
  @entries
end

Instance Method Details

#generate(load_path) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/bootscale/cache_builder.rb', line 9

def generate(load_path)
  ordered_entries = load_path.map do |path|
    path = path.to_s
    entries[path] ||= Entry.new(path)
  end
  Hash[ordered_entries.reverse.flat_map(&:features)]
end