lib/boris.rb in boris-1.0.2 vs lib/boris.rb in boris-1.0.3
- old
+ new
@@ -1,8 +1,9 @@
# encoding: UTF-8
PLATFORM = RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ ? :win32 : RbConfig::CONFIG['host_os']
+LIB_PATH = File.expand_path('..', __FILE__)
require 'date'
require 'json'
require 'logger'
require 'netaddr'
@@ -11,8 +12,22 @@
require 'snmp'
require 'socket'
require 'thread'
require 'win32ole' if PLATFORM == :win32
-require 'boris/helpers'
-require 'boris/lumberjack'
require 'boris/target'
+
+module Boris
+ # Returns an array of all profiler classes that are currently available. If this
+ # is launched from a non-Windows machine, the Windows-based profilers will not be
+ # available.
+ #
+ # @return [Array] list of profiler classes
+ def self.available_profilers
+ ObjectSpace.each_object(Class).select{|klass| klass.to_s =~ /profilers/i}.inject([]) do |result, klass|
+ if !(klass.to_s =~ /windows/i && PLATFORM != :win32) && klass.respond_to?(:matches_target?)
+ result << klass
+ end
+ result
+ end.sort_by {|klass| klass.to_s}
+ end
+end
\ No newline at end of file