Class: GemBench::Scout

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(check_gemfile: nil) ⇒ Scout

Returns a new instance of Scout.



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

def initialize(check_gemfile: nil)
  @check_gemfile = check_gemfile.nil? ? true : check_gemfile
  @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.



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

def gem_paths
  @gem_paths
end

#gemfile_linesObject (readonly)

Returns the value of attribute gemfile_lines.



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

def gemfile_lines
  @gemfile_lines
end

#gemfile_pathObject (readonly)

Returns the value of attribute gemfile_path.



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

def gemfile_path
  @gemfile_path
end

#gemfile_trashObject (readonly)

Returns the value of attribute gemfile_trash.



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

def gemfile_trash
  @gemfile_trash
end

#loaded_gemsObject (readonly)

Returns the value of attribute loaded_gems.



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

def loaded_gems
  @loaded_gems
end

Instance Method Details

#check_gemfile?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/gem_bench/scout.rb', line 15

def check_gemfile?
  @check_gemfile
end