Class: Source2MD::CodeBlock
- Inherits:
-
Object
- Object
- Source2MD::CodeBlock
- Defined in:
- lib/source2md/code_block.rb
Constant Summary collapse
- PADDING_KEEP =
2- MARK =
"# =>"
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
Instance Method Summary collapse
-
#initialize(code, options = {}) ⇒ CodeBlock
constructor
A new instance of CodeBlock.
- #to_md ⇒ Object
Constructor Details
#initialize(code, options = {}) ⇒ CodeBlock
Returns a new instance of CodeBlock.
8 9 10 11 12 13 14 |
# File 'lib/source2md/code_block.rb', line 8 def initialize(code, = {}) @code = code @options = { :lang => "ruby", # :single_sharp_replace_to_blank_line => false, }.merge() end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
6 7 8 |
# File 'lib/source2md/code_block.rb', line 6 def code @code end |
Instance Method Details
#to_md ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/source2md/code_block.rb', line 16 def to_md [ "```#{code_block_head}", normalized_code, "```", ] * "\n" end |