Class: Elf::Utilities::FilePool

Inherits:
Object
  • Object
show all
Defined in:
lib/elf/utils/pool.rb

Overview

Pool for ELF files.

This pool is useful for tools that recurse over a tree of dependencies to avoid creating multiple instances of Elf::File accessing the same file.

Class Method Summary collapse

Class Method Details

.[](file) ⇒ Object



31
32
33
34
35
# File 'lib/elf/utils/pool.rb', line 31

def self.[](file)
  realfile = Pathname.new(file).realpath
  
  @pool[realfile] ||= Elf::File.new(realfile)
end