Class: Dump::Reader::Summary

Inherits:
Object
  • Object
show all
Defined in:
lib/dump/reader.rb

Overview

Helper class for building summary of dump

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSummary

Returns a new instance of Summary.



33
34
35
# File 'lib/dump/reader.rb', line 33

def initialize
  @text = ''.dup
end

Instance Attribute Details

#textObject (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