Class: Solargraph::Pin::Documenting::DocSection
- Inherits:
-
Object
- Object
- Solargraph::Pin::Documenting::DocSection
- Defined in:
- lib/solargraph/pin/documenting.rb
Overview
A documentation formatter that either performs Markdown conversion for text, or applies backticks for code blocks.
Instance Attribute Summary collapse
- #plaintext ⇒ String readonly
Instance Method Summary collapse
- #code? ⇒ Boolean
- #concat(text) ⇒ String
-
#initialize(code) ⇒ DocSection
constructor
A new instance of DocSection.
- #to_s ⇒ Object
Constructor Details
#initialize(code) ⇒ DocSection
Returns a new instance of DocSection.
41 42 43 44 |
# File 'lib/solargraph/pin/documenting.rb', line 41 def initialize code @plaintext = String.new('') @code = code end |
Instance Attribute Details
#plaintext ⇒ String (readonly)
38 39 40 |
# File 'lib/solargraph/pin/documenting.rb', line 38 def plaintext @plaintext end |
Instance Method Details
#code? ⇒ Boolean
46 47 48 |
# File 'lib/solargraph/pin/documenting.rb', line 46 def code? @code end |
#concat(text) ⇒ String
52 53 54 |
# File 'lib/solargraph/pin/documenting.rb', line 52 def concat text @plaintext.concat text end |
#to_s ⇒ Object
56 57 58 59 |
# File 'lib/solargraph/pin/documenting.rb', line 56 def to_s return to_code if code? to_markdown end |