title: How do you check if a library/ruby-gem has been loaded?
body: <p>In ruby code, how would I check what external libraries are loaded? For example,</p>
  
  <pre><code>require 'some-library'
  if is-loaded?('some-library')
    puts "this will run"
  end
  </code></pre>
  
  <p>or</p>
  
  <pre><code># require 'some-library' Don't load it in here
  if is-loaded?('some-library')
    puts "this will not run"
  end
  </code></pre>
  
  <p>Is there a way to do this?</p>
  
  <p>Note on why I need this:
  I'm working on <a href="https://github.com/holman/boom" rel="noreferrer">boom</a>, and on windows, it will try to include 'Win32/Console/ANSI', to enable ANSI color codes like \e[36m. What I'm trying to do is if the system is windows and 'Win32/Console/ANSI' is not loaded, it would append the color codes, so the color codes are not outputted. <a href="https://github.com/holman/boom/blob/master/lib/boom/color.rb" rel="noreferrer">Here is the file.</a></p>