Class: Pslm::ConsoleOutputter::Formatter
- Inherits:
-
Object
- Object
- Pslm::ConsoleOutputter::Formatter
show all
- Defined in:
- lib/pslm/consoleoutputter.rb
Overview
abstract superclass of the formatters providing dumb implementation of all formatting methods
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Formatter
Returns a new instance of Formatter.
102
103
104
105
106
107
108
|
# File 'lib/pslm/consoleoutputter.rb', line 102
def initialize(options)
@options = options
@syll_counter = 0
@word_counter = 0
@part_counter = 0
@verse_counter = 0
end
|
Class Method Details
lets all the :formatters: subsequently format :text: assembled from :obj: on the assembly :level:
94
95
96
97
98
99
|
# File 'lib/pslm/consoleoutputter.rb', line 94
def format(formatters, level, text, *args)
formatters.each do |f|
text = f.send("#{level}_format", text, *args)
end
return text
end
|
Instance Method Details
126
127
128
129
130
131
|
# File 'lib/pslm/consoleoutputter.rb', line 126
def part_format(text, part)
@part_counter += 1
@syll_counter = 0
@word_counter = 0
text
end
|
110
111
112
113
114
115
116
|
# File 'lib/pslm/consoleoutputter.rb', line 110
def psalm_format(text, psalm)
@syll_counter = 0
@word_counter = 0
@part_counter = 0
@verse_counter = 0
text
end
|
138
139
140
141
|
# File 'lib/pslm/consoleoutputter.rb', line 138
def syllable_format(text, part, word, syll)
@syll_counter += 1
text
end
|
118
119
120
121
122
123
124
|
# File 'lib/pslm/consoleoutputter.rb', line 118
def verse_format(text, psalm, verse)
@verse_counter += 1
@syll_counter = 0
@word_counter = 0
@part_counter = 0
text
end
|
133
134
135
136
|
# File 'lib/pslm/consoleoutputter.rb', line 133
def word_format(text, word)
@word_counter += 1
text
end
|