Class: Propolize::SpecialChunk
- Inherits:
-
LinesChunk
- Object
- LinesChunk
- Propolize::SpecialChunk
- Defined in:
- lib/propolize.rb
Overview
Special chunk contains a name and an optional value examples - “##appendix”, “##date 23 May, 2014” “##author John Smith”
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from LinesChunk
Instance Method Summary collapse
- #getDocumentComponent ⇒ Object
-
#initialize(name, line) ⇒ SpecialChunk
constructor
A new instance of SpecialChunk.
-
#isTerminatedBy?(line) ⇒ Boolean
“special chunk” is terminated by a blank line, or by the start of the next special chunk.
- #to_s ⇒ Object
Methods inherited from LinesChunk
Constructor Details
#initialize(name, line) ⇒ SpecialChunk
Returns a new instance of SpecialChunk.
762 763 764 765 |
# File 'lib/propolize.rb', line 762 def initialize(name, line) super(line) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
761 762 763 |
# File 'lib/propolize.rb', line 761 def name @name end |
Instance Method Details
#getDocumentComponent ⇒ Object
776 777 778 779 780 781 782 |
# File 'lib/propolize.rb', line 776 def getDocumentComponent if name == "appendix" return StartAppendix.new() # special "start appendix" command, or, else return DocumentProperty.new(name, lines.join("\n")) # a named property value end end |
#isTerminatedBy?(line) ⇒ Boolean
“special chunk” is terminated by a blank line, or by the start of the next special chunk
772 773 774 |
# File 'lib/propolize.rb', line 772 def isTerminatedBy?(line) return (/^\#\#/.match(line) or /^\s*$/.match(line)) end |
#to_s ⇒ Object
767 768 769 |
# File 'lib/propolize.rb', line 767 def to_s return "SpecialChunk: (#{name}) #{lines.inspect}" end |