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.
31 32 33 |
# File 'lib/dump/reader.rb', line 31 def initialize @text = '' end |
Instance Attribute Details
#text ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute text.
29 30 31 |
# File 'lib/dump/reader.rb', line 29 def text @text end |
Class Method Details
.pluralize(count, singular) ⇒ Object
from ActionView::Helpers::TextHelper
46 47 48 |
# File 'lib/dump/reader.rb', line 46 def self.pluralize(count, singular) "#{count} #{count == 1 ? singular : singular.pluralize}" end |
Instance Method Details
#data(entries) ⇒ Object
39 40 41 42 43 |
# File 'lib/dump/reader.rb', line 39 def data(entries) entries.each do |entry| @text << " #{entry}\n" end end |
#header(header) ⇒ Object
35 36 37 |
# File 'lib/dump/reader.rb', line 35 def header(header) @text << " #{header}:\n" end |