Class: CSKitStrongs::Annotator

Inherits:
CSKit::Annotator
  • Object
show all
Defined in:
lib/cskit-strongs/annotator.rb

Instance Method Summary collapse

Instance Method Details

#annotate(reading, volume) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cskit-strongs/annotator.rb', line 8

def annotate(reading, volume)
  annotated_reading = reading.to_annotated_reading
  resource = concordance_resource_for(reading, volume)

  reading.texts.each_with_index do |text, index|
    verse_num = reading.verse.start + index
    corresponding_verse_texts = resource[verse_num.to_s]

    each_annotation_for(text, corresponding_verse_texts) do |annotation|
      annotated_reading.add_annotation(index, annotation)
    end
  end

  annotated_reading
end

#available_formattersObject



33
34
35
# File 'lib/cskit-strongs/annotator.rb', line 33

def available_formatters
  [:plain_text, :html]
end

#get_formatter(type = :plain_text) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/cskit-strongs/annotator.rb', line 24

def get_formatter(type = :plain_text)
  case type
    when :plain_text
      CSKitStrongs::Formatters::StrongsPlainTextFormatter
    when :html
      CSKitStrongs::Formatters::StrongsHtmlFormatter
  end
end