Class: GemBench::Scout

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_bench/scout.rb

Overview

Looks through loaded gems’ (RubyGems & Bundler) source code searching for stuff

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(check_gemfile: nil, **options) ⇒ Scout

Returns a new instance of Scout.



8
9
10
11
12
13
14
15
# File 'lib/gem_bench/scout.rb', line 8

def initialize(check_gemfile: nil, **options)
  @check_gemfile = check_gemfile.nil? ? true : check_gemfile
  @gemfile_path = options.fetch(:gemfile_path, "#{Dir.pwd}/Gemfile")
  gem_lookup_paths_from_bundler
  gem_lines_from_gemfile
  # Gem.loaded_specs are the gems that have been loaded / required.
  @loaded_gems = Gem.loaded_specs.values.map { |x| [x.name, x.version.to_s] }
end

Instance Attribute Details

#gem_pathsObject (readonly)

Returns the value of attribute gem_paths.



6
7
8
# File 'lib/gem_bench/scout.rb', line 6

def gem_paths
  @gem_paths
end

#gemfile_linesObject (readonly)

Returns the value of attribute gemfile_lines.



6
7
8
# File 'lib/gem_bench/scout.rb', line 6

def gemfile_lines
  @gemfile_lines
end

#gemfile_pathObject (readonly)

Returns the value of attribute gemfile_path.



6
7
8
# File 'lib/gem_bench/scout.rb', line 6

def gemfile_path
  @gemfile_path
end

#gemfile_trashObject (readonly)

Returns the value of attribute gemfile_trash.



6
7
8
# File 'lib/gem_bench/scout.rb', line 6

def gemfile_trash
  @gemfile_trash
end

#loaded_gemsObject (readonly)

Returns the value of attribute loaded_gems.



6
7
8
# File 'lib/gem_bench/scout.rb', line 6

def loaded_gems
  @loaded_gems
end

Instance Method Details

#check_gemfile?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/gem_bench/scout.rb', line 17

def check_gemfile?
  @check_gemfile
end