Class: XfOOrth::BulletPoints
- Defined in:
- lib/fOOrth/library/formatting/bullets.rb
Overview
A class to display data in bullet points.
Instance Method Summary collapse
-
#add(bullet, *items) ⇒ Object
Add items to these bullet points.
-
#initialize(page_width) ⇒ BulletPoints
constructor
Prepare a blank slate.
-
#render ⇒ Object
Render the bullet points as an array of strings.
Constructor Details
#initialize(page_width) ⇒ BulletPoints
Prepare a blank slate.
10 11 12 13 |
# File 'lib/fOOrth/library/formatting/bullets.rb', line 10 def initialize(page_width) @page_width = page_width @bullet_data = [] end |
Instance Method Details
#add(bullet, *items) ⇒ Object
Add items to these bullet points.
16 17 18 19 20 21 |
# File 'lib/fOOrth/library/formatting/bullets.rb', line 16 def add(bullet, *items) items.each do |item| @bullet_data << [bullet.to_s, item] bullet = "" end end |
#render ⇒ Object
Render the bullet points as an array of strings.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fOOrth/library/formatting/bullets.rb', line 24 def render @key_length, results = get_key_length, [] @bullet_data.each do |key, item| results.concat(render_bullet(key, item)) end @bullet_data = [] results end |