Class: RenderAsMarkdown::Code
- Inherits:
-
Object
- Object
- RenderAsMarkdown::Code
- Defined in:
- lib/render-as-markdown/code.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
TODO: render language for code block if provided as Symbol TODO: add file support.
Instance Method Summary collapse
-
#initialize(code) ⇒ Code
constructor
A new instance of Code.
- #render ⇒ Object (also: #to_s)
Constructor Details
#initialize(code) ⇒ Code
Returns a new instance of Code.
9 10 11 |
# File 'lib/render-as-markdown/code.rb', line 9 def initialize code @code = code.to_s end |
Instance Attribute Details
#code ⇒ Object
TODO: render language for code block if provided as Symbol TODO: add file support
7 8 9 |
# File 'lib/render-as-markdown/code.rb', line 7 def code @code end |
Instance Method Details
#render ⇒ Object Also known as: to_s
13 14 15 16 17 |
# File 'lib/render-as-markdown/code.rb', line 13 def render md = '' @code.lines.each {|l| md << " " << l } md end |