Class: Prawn::Dev::YardMarkup::CodeFormatter
- Inherits:
-
Rouge::Formatter
- Object
- Rouge::Formatter
- Prawn::Dev::YardMarkup::CodeFormatter
- Defined in:
- lib/prawn/dev/yard_markup/document.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ CodeFormatter
constructor
A new instance of CodeFormatter.
- #stream(tokens) {|%(<pre><code>)| ... } ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ CodeFormatter
Returns a new instance of CodeFormatter.
11 12 13 14 15 16 17 18 19 |
# File 'lib/prawn/dev/yard_markup/document.rb', line 11 def initialize(opts = {}) @opts = opts @formatter = if opts[:inline_theme] ::Rouge::Formatters::HTMLInline.new(opts[:inline_theme]) else ::Rouge::Formatters::HTML.new end end |
Instance Method Details
#stream(tokens) {|%(<pre><code>)| ... } ⇒ Object
21 22 23 24 25 |
# File 'lib/prawn/dev/yard_markup/document.rb', line 21 def stream(tokens, &block) yield %(<pre><code>) unless @opts[:inline] @formatter.stream(tokens, &block) yield '</code></pre>' unless @opts[:inline] end |