Class: CodeBlockParser
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Parser
#initialize, #setNext
Constructor Details
This class inherits a constructor from Parser
Instance Attribute Details
#nextParser ⇒ Object
Returns the value of attribute nextParser.
7
8
9
|
# File 'lib/Parsers/CodeBlockParser.rb', line 7
def nextParser
@nextParser
end
|
Class Method Details
.getTypeString ⇒ Object
9
10
11
|
# File 'lib/Parsers/CodeBlockParser.rb', line 9
def self.getTypeString()
'CODE_BLOCK'
end
|
.isCodeBlock(paragraph) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/Parsers/CodeBlockParser.rb', line 13
def self.isCodeBlock(paragraph)
if paragraph.nil?
false
else
paragraph.type == CodeBlockParser.getTypeString()
end
end
|
Instance Method Details
#parse(paragraph) ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/Parsers/CodeBlockParser.rb', line 21
def parse(paragraph)
if CodeBlockParser.isCodeBlock(paragraph)
"```\n#{paragraph.text}\n```"
else
if !nextParser.nil?
nextParser.parse(paragraph)
end
end
end
|