Skip to content

Instantly share code, notes, and snippets.

@lsegal
Created August 25, 2009 00:09
Show Gist options
  • Save lsegal/174326 to your computer and use it in GitHub Desktop.
Save lsegal/174326 to your computer and use it in GitHub Desktop.
diff --git a/lib/yard/generators/helpers/markup_helper.rb b/lib/yard/generators/helpers/markup_helper.rb
index 7cb483a..a5d0d33 100644
--- a/lib/yard/generators/helpers/markup_helper.rb
+++ b/lib/yard/generators/helpers/markup_helper.rb
@@ -1,12 +1,3 @@
-if RUBY19
- require 'rdoc/markup'
- require 'rdoc/markup/to_html'
-else
- require 'rdoc/markup/simple_markup'
- require 'rdoc/markup/simple_markup/to_html'
- require 'rubygems'
-end
-
module YARD
module Generators::Helpers
module MarkupHelper
@@ -21,8 +12,17 @@ module YARD
{:lib => :redcloth, :const => 'RedCloth'}
]
}
-
- SimpleMarkup = RUBY19 ? RDoc::Markup.new : SM::SimpleMarkup.new
+
+ begin
+ require 'rdoc/markup'
+ require 'rdoc/markup/to_html'
+ SimpleMarkup = RDoc::Markup.new
+ rescue LoadError
+ require 'rubygems'
+ require 'rdoc/markup/simple_markup'
+ require 'rdoc/markup/simple_markup/to_html'
+ SimpleMarkup = SM::SimpleMarkup.new
+ end
private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment