Class: ScoutApm::Utils::InstalledGems

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/utils/installed_gems.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger = ScoutApm::Agent.instance.logger) ⇒ InstalledGems

Returns a new instance of InstalledGems.



6
7
8
# File 'lib/scout_apm/utils/installed_gems.rb', line 6

def initialize(logger=ScoutApm::Agent.instance.logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/scout_apm/utils/installed_gems.rb', line 4

def logger
  @logger
end

Instance Method Details

#runObject



10
11
12
13
14
15
# File 'lib/scout_apm/utils/installed_gems.rb', line 10

def run
  Bundler.rubygems.all_specs.map {|spec| [spec.name, spec.version.to_s] }
rescue => e
  logger.warn("Couldn't fetch Gem information: #{e.message}")
  []
end