Class: Pslm::LatexOutputter::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/pslm/latexoutputter.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.



121
122
123
124
125
126
127
# File 'lib/pslm/latexoutputter.rb', line 121

def initialize(options)
  @options = options
  @syll_counter = 0
  @word_counter = 0
  @part_counter = 0
  @verse_counter = 0
end

Class Method Details

.format(formatters, level, text, *args) ⇒ Object

lets all the :formatters: subsequently format :text: assembled from :obj: on the assembly :level:



113
114
115
116
117
118
# File 'lib/pslm/latexoutputter.rb', line 113

def format(formatters, level, text, *args)
  formatters.each do |f|
    text = f.send("#{level}_format", text, *args)
  end
  return text
end

Instance Method Details

#part_format(text, part, verse, strophe, psalm) ⇒ Object



149
150
151
152
153
154
# File 'lib/pslm/latexoutputter.rb', line 149

def part_format(text, part, verse, strophe, psalm)
  @part_counter += 1
  @syll_counter = 0
  @word_counter = 0
  text
end

#psalm_format(text, psalm) ⇒ Object



129
130
131
132
133
134
135
# File 'lib/pslm/latexoutputter.rb', line 129

def psalm_format(text, psalm)
  @syll_counter = 0
  @word_counter = 0
  @part_counter = 0
  @verse_counter = 0
  text
end

#strophe_format(text, strophe, psalm) ⇒ Object



137
138
139
# File 'lib/pslm/latexoutputter.rb', line 137

def strophe_format(text, strophe, psalm)
  text
end

#syllable_format(text, syll, word, part, verse, strophe, psalm) ⇒ Object



161
162
163
164
# File 'lib/pslm/latexoutputter.rb', line 161

def syllable_format(text, syll, word, part, verse, strophe, psalm)
  @syll_counter += 1
  text
end

#verse_format(text, verse, strophe, psalm) ⇒ Object



141
142
143
144
145
146
147
# File 'lib/pslm/latexoutputter.rb', line 141

def verse_format(text, verse, strophe, psalm)
  @verse_counter += 1
  @syll_counter = 0
  @word_counter = 0
  @part_counter = 0
  text
end

#word_format(text, word, part, verse, strophe, psalm) ⇒ Object



156
157
158
159
# File 'lib/pslm/latexoutputter.rb', line 156

def word_format(text, word, part, verse, strophe, psalm)
  @word_counter += 1
  text
end