Class: Dump::Reader::Summary
- Inherits:
-
Object
- Object
- Dump::Reader::Summary
- Defined in:
- lib/dump/reader.rb
Overview
Helper class for building summary of dump
Instance Attribute Summary collapse
-
#text ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute text.
Class Method Summary collapse
-
.pluralize(count, singular) ⇒ Object
from ActionView::Helpers::TextHelper.
Instance Method Summary collapse
- #data(entries) ⇒ Object
- #header(header) ⇒ Object
-
#initialize ⇒ Summary
constructor
A new instance of Summary.
Constructor Details
#initialize ⇒ Summary
Returns a new instance of Summary.
33 34 35 |
# File 'lib/dump/reader.rb', line 33 def initialize @text = ''.dup end |
Instance Attribute Details
#text ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute text.
31 32 33 |
# File 'lib/dump/reader.rb', line 31 def text @text end |
Class Method Details
.pluralize(count, singular) ⇒ Object
from ActionView::Helpers::TextHelper
48 49 50 |
# File 'lib/dump/reader.rb', line 48 def self.pluralize(count, singular) "#{count} #{count == 1 ? singular : singular.pluralize}" end |
Instance Method Details
#data(entries) ⇒ Object
41 42 43 44 45 |
# File 'lib/dump/reader.rb', line 41 def data(entries) entries.each do |entry| @text << " #{entry}\n" end end |
#header(header) ⇒ Object
37 38 39 |
# File 'lib/dump/reader.rb', line 37 def header(header) @text << " #{header}:\n" end |