Class: Polytrix::Documentation::Helpers::CodeHelper::ReStructuredTextHelper
- Inherits:
-
Object
- Object
- Polytrix::Documentation::Helpers::CodeHelper::ReStructuredTextHelper
- Defined in:
- lib/polytrix/documentation/helpers/code_helper.rb
Class Method Summary collapse
Class Method Details
.code_block(source, language) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/polytrix/documentation/helpers/code_helper.rb', line 9 def self.code_block(source, language) buffer = StringIO.new buffer.puts ".. code-block:: #{language}" indented_source = source.lines.map do|line| " #{line}" end.join("\n") buffer.puts indented_source buffer.string end |