Class: Prezio::SyntaxHighlighter
- Inherits:
-
Object
- Object
- Prezio::SyntaxHighlighter
- Defined in:
- lib/prezio/syntax_highlighter.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(html) ⇒ SyntaxHighlighter
constructor
A new instance of SyntaxHighlighter.
- #to_s ⇒ Object
Constructor Details
#initialize(html) ⇒ SyntaxHighlighter
Returns a new instance of SyntaxHighlighter.
10 11 12 |
# File 'lib/prezio/syntax_highlighter.rb', line 10 def initialize(html) @html = html end |
Class Method Details
.highlight(html) ⇒ Object
6 7 8 |
# File 'lib/prezio/syntax_highlighter.rb', line 6 def self.highlight(html) new(html).to_s end |
Instance Method Details
#to_s ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/prezio/syntax_highlighter.rb', line 14 def to_s doc = Nokogiri::HTML.fragment(@html) (doc) add_highliting_styles(doc) doc.to_s end |