Class: RDocF95::Markup::LineCollection
- Inherits:
-
Object
- Object
- RDocF95::Markup::LineCollection
- Defined in:
- lib/rdoc-f95/markup/fragments.rb
Overview
Collect groups of lines together. Each group will end up containing a flow of text.
Instance Method Summary collapse
- #accept(am, visitor) ⇒ Object
- #add(fragment) ⇒ Object
- #each(&b) ⇒ Object
-
#fragment_for(*args) ⇒ Object
Factory for different fragment types.
-
#initialize ⇒ LineCollection
constructor
A new instance of LineCollection.
-
#normalize ⇒ Object
Tidy up at the end.
-
#to_a ⇒ Object
:nodoc:.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ LineCollection
Returns a new instance of LineCollection.
135 136 137 |
# File 'lib/rdoc-f95/markup/fragments.rb', line 135 def initialize @fragments = [] end |
Instance Method Details
#accept(am, visitor) ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/rdoc-f95/markup/fragments.rb', line 172 def accept(am, visitor) visitor.start_accepting @fragments.each do |fragment| case fragment when Verbatim visitor.accept_verbatim(am, fragment) when Rule visitor.accept_rule(am, fragment) when ListStart visitor.accept_list_start(am, fragment) when ListEnd visitor.accept_list_end(am, fragment) when ListItem visitor.accept_list_item(am, fragment) when BlankLine visitor.accept_blank_line(am, fragment) when Heading visitor.accept_heading(am, fragment) when Paragraph visitor.accept_paragraph(am, fragment) end end visitor.end_accepting end |
#add(fragment) ⇒ Object
139 140 141 |
# File 'lib/rdoc-f95/markup/fragments.rb', line 139 def add(fragment) @fragments << fragment end |
#each(&b) ⇒ Object
143 144 145 |
# File 'lib/rdoc-f95/markup/fragments.rb', line 143 def each(&b) @fragments.each(&b) end |
#fragment_for(*args) ⇒ Object
Factory for different fragment types
154 155 156 |
# File 'lib/rdoc-f95/markup/fragments.rb', line 154 def fragment_for(*args) Fragment.for(*args) end |
#normalize ⇒ Object
Tidy up at the end
161 162 163 164 165 166 |
# File 'lib/rdoc-f95/markup/fragments.rb', line 161 def normalize change_verbatim_blank_lines add_list_start_and_ends add_list_breaks tidy_blank_lines end |
#to_a ⇒ Object
:nodoc:
147 148 149 |
# File 'lib/rdoc-f95/markup/fragments.rb', line 147 def to_a # :nodoc: @fragments.map {|fragment| fragment.to_s} end |
#to_s ⇒ Object
168 169 170 |
# File 'lib/rdoc-f95/markup/fragments.rb', line 168 def to_s @fragments.join("\n----\n") end |