Class: CodeBlockParser
Instance Attribute Summary collapse
-
#isForJekyll ⇒ Object
Returns the value of attribute isForJekyll.
-
#nextParser ⇒ Object
Returns the value of attribute nextParser.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(isForJekyll) ⇒ CodeBlockParser
constructor
A new instance of CodeBlockParser.
- #parse(paragraph) ⇒ Object
Methods inherited from Parser
Constructor Details
#initialize(isForJekyll) ⇒ CodeBlockParser
Returns a new instance of CodeBlockParser.
9 10 11 |
# File 'lib/Parsers/CodeBlockParser.rb', line 9 def initialize(isForJekyll) @isForJekyll = isForJekyll end |
Instance Attribute Details
#isForJekyll ⇒ Object
Returns the value of attribute isForJekyll.
7 8 9 |
# File 'lib/Parsers/CodeBlockParser.rb', line 7 def isForJekyll @isForJekyll end |
#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
13 14 15 |
# File 'lib/Parsers/CodeBlockParser.rb', line 13 def self.getTypeString() 'CODE_BLOCK' end |
.isCodeBlock(paragraph) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/Parsers/CodeBlockParser.rb', line 17 def self.isCodeBlock(paragraph) if paragraph.nil? false else paragraph.type == CodeBlockParser.getTypeString() end end |
Instance Method Details
#parse(paragraph) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/Parsers/CodeBlockParser.rb', line 25 def parse(paragraph) if CodeBlockParser.isCodeBlock(paragraph) result = "```\n" result += paragraph.text.chomp result += "\n```" else if !nextParser.nil? nextParser.parse(paragraph) end end end |