Class: ScoutApm::Utils::InstalledGems
- Inherits:
-
Object
- Object
- ScoutApm::Utils::InstalledGems
- Defined in:
- lib/scout_apm/utils/installed_gems.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context) ⇒ InstalledGems
constructor
A new instance of InstalledGems.
- #logger ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(context) ⇒ InstalledGems
Returns a new instance of InstalledGems.
6 7 8 |
# File 'lib/scout_apm/utils/installed_gems.rb', line 6 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/scout_apm/utils/installed_gems.rb', line 4 def context @context end |
Instance Method Details
#logger ⇒ Object
10 11 12 |
# File 'lib/scout_apm/utils/installed_gems.rb', line 10 def logger context.logger end |
#run ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/scout_apm/utils/installed_gems.rb', line 14 def run specs = Bundler.rubygems.public_send(Bundler.rubygems.respond_to?(:installed_specs) ? :installed_specs : :all_specs) specs.map { |spec| [spec.name, spec.version.to_s] } rescue => e logger.warn("Couldn't fetch Gem information: #{e.}") [] end |