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.



31
32
33
# File 'lib/dump/reader.rb', line 31

def initialize
  @text = ''
end

Instance Attribute Details

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