def detect(options={}, &block)
      options = {methods: true}.merge!(options)
      original_gems = defined?(Gem) ? Gem.loaded_specs.keys : []
      original_object_methods = Object.instance_methods
      original_instance_methods = Boson.main_object.singleton_class.instance_methods
      original_modules = modules if options[:modules]

      block.call

      detected = {}
      detected[:methods] = options[:methods] ?
        (Boson.main_object.singleton_class.instance_methods -
           original_instance_methods) : []
      unless options[:object_methods]
        detected[:methods] -= (Object.instance_methods - original_object_methods)
      end
      detected[:gems] = Gem.loaded_specs.keys - original_gems if defined? Gem
      detected[:modules] = modules - original_modules if options[:modules]
      detected
    end
def detect(options={}, &block)
      options = {methods: true}.merge!(options)
      original_gems = defined?(Gem) ? Gem.loaded_specs.keys : []
      original_object_methods = Object.instance_methods
      original_instance_methods = Boson.main_object.singleton_class.instance_methods
      original_modules = modules if options[:modules]

      block.call

      detected = {}
      detected[:methods] = options[:methods] ?
        (Boson.main_object.singleton_class.instance_methods -
           original_instance_methods) : []
      unless options[:object_methods]
        detected[:methods] -= (Object.instance_methods - original_object_methods)
      end
      detected[:gems] = Gem.loaded_specs.keys - original_gems if defined? Gem
      detected[:modules] = modules - original_modules if options[:modules]
      detected
    end
Detects new object/kernel methods, gems and modules created within a
 block. Returns a hash of what's detected. Valid options and possible
 returned keys are :methods, :object_methods, :modules, :gems.