Sha256: a0d95fc289622b7164a09110aecb7db2bc3a395ed05f0e599940a9b81b72a490

Contents?: true

Size: 923 Bytes

Versions: 14

Compression:

Stored size: 923 Bytes

Contents

# encoding: utf-8

module TuneMyGc
  module Spies
    def self.spy(s, file)
      autoload s, "tunemygc/spies/#{file}"
      (@spies ||= {})[file] = s.to_s
    end

    spy :Base, 'base'

    # Web
    spy :ActionController, 'action_controller'

    # Manual
    spy :Manual, 'manual'

    # Tests
    spy :Minitest, 'minitest'
    spy :Rspec, 'rspec'

    # Async jobs
    spy :ActiveJob, 'active_job'
    spy :QueJob, 'que_job'
    spy :DelayedJob, 'delayed_job'

    def self.ids
      current.map do |spy|
        @spies.key(spy)
      end.join(',')
    end

    def self.current
      if ENV['RUBY_GC_SPY'] && ENV['RUBY_GC_SPY'] != ""
        ENV['RUBY_GC_SPY'].split(",").map do |spy|
          @spies[spy] || raise(NotImplementedError, "TuneMyGC spy #{spy} not supported. Valid spies are #{@spies.keys}")
        end
      else
        [(TuneMyGc.rails? ? 'ActionController' : 'Manual')]
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
tunemygc-1.0.71 lib/tunemygc/spies.rb
tunemygc-1.0.69 lib/tunemygc/spies.rb
tunemygc-1.0.68 lib/tunemygc/spies.rb
tunemygc-1.0.67 lib/tunemygc/spies.rb
tunemygc-1.0.65 lib/tunemygc/spies.rb
tunemygc-1.0.64 lib/tunemygc/spies.rb
tunemygc-1.0.63 lib/tunemygc/spies.rb
tunemygc-1.0.62 lib/tunemygc/spies.rb
tunemygc-1.0.61 lib/tunemygc/spies.rb
tunemygc-1.0.60 lib/tunemygc/spies.rb
tunemygc-1.0.59 lib/tunemygc/spies.rb
tunemygc-1.0.58 lib/tunemygc/spies.rb
tunemygc-1.0.57 lib/tunemygc/spies.rb
tunemygc-1.0.56 lib/tunemygc/spies.rb