Class: GemBench::Scout
- Inherits:
-
Object
- Object
- GemBench::Scout
- Defined in:
- lib/gem_bench/scout.rb
Overview
Looks through loaded gems’ (RubyGems & Bundler) source code searching for stuff
Instance Attribute Summary collapse
-
#gem_paths ⇒ Object
readonly
Returns the value of attribute gem_paths.
-
#gemfile_lines ⇒ Object
readonly
Returns the value of attribute gemfile_lines.
-
#gemfile_path ⇒ Object
readonly
Returns the value of attribute gemfile_path.
-
#gemfile_trash ⇒ Object
readonly
Returns the value of attribute gemfile_trash.
-
#loaded_gems ⇒ Object
readonly
Returns the value of attribute loaded_gems.
Instance Method Summary collapse
- #check_gemfile? ⇒ Boolean
-
#initialize(check_gemfile: nil, **options) ⇒ Scout
constructor
A new instance of Scout.
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, **) @check_gemfile = check_gemfile.nil? ? true : check_gemfile @gemfile_path = .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_paths ⇒ Object (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_lines ⇒ Object (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_path ⇒ Object (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_trash ⇒ Object (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_gems ⇒ Object (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
17 18 19 |
# File 'lib/gem_bench/scout.rb', line 17 def check_gemfile? @check_gemfile end |