Module: Bootscale

Defined in:
lib/bootscale.rb,
lib/bootscale/entry.rb,
lib/bootscale/version.rb,
lib/bootscale/file_storage.rb,
lib/bootscale/cache_builder.rb

Defined Under Namespace

Classes: CacheBuilder, Entry, FileStorage

Constant Summary collapse

DOT_SO =
'.so'.freeze
DOT_RB =
'.rb'.freeze
LEADING_SLASH =
'/'.freeze
VERSION =
'0.5.1'

Class Method Summary collapse

Class Method Details

.[](path) ⇒ Object



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

def [](path)
  path = path.to_s
  return if path.start_with?(LEADING_SLASH)
  if path.end_with?(DOT_RB, DOT_SO)
    @cache[path]
  else
    @cache["#{path}#{DOT_RB}"] || @cache["#{path}#{DOT_SO}"]
  end
end

.regenerateObject



25
26
27
# File 'lib/bootscale.rb', line 25

def regenerate
  @cache = load_cache || save_cache(cache_builder.generate($LOAD_PATH))
end

.setup(options = {}) ⇒ Object



19
20
21
22
23
# File 'lib/bootscale.rb', line 19

def setup(options = {})
  self.cache_directory = options[:cache_directory]
  require_relative 'bootscale/core_ext'
  regenerate
end