Class: KDomain::RailsCodeExtractor::ShimLoader

Inherits:
Object
  • Object
show all
Includes:
KLog::Logging
Defined in:
lib/k_domain/rails_code_extractor/shim_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeShimLoader

Returns a new instance of ShimLoader.



16
17
18
# File 'lib/k_domain/rails_code_extractor/shim_loader.rb', line 16

def initialize
  @shim_files = []
end

Instance Attribute Details

#shim_filesObject (readonly)

Returns the value of attribute shim_files.



14
15
16
# File 'lib/k_domain/rails_code_extractor/shim_loader.rb', line 14

def shim_files
  @shim_files
end

Instance Method Details

#callObject



20
21
22
23
24
25
# File 'lib/k_domain/rails_code_extractor/shim_loader.rb', line 20

def call
  shim_files.select { |sf| sf[:exist] }.each do |sf|
    require sf[:file]
  end
  nil
end

#register(name, file) ⇒ Object



27
28
29
# File 'lib/k_domain/rails_code_extractor/shim_loader.rb', line 27

def register(name, file)
  @shim_files << { name: name, file: file, exist: File.exist?(file) }
end