Class: CSKitStrongs::Splitters::GreekLexiconSplitter

Inherits:
Object
  • Object
show all
Includes:
Utilities, Enumerable
Defined in:
lib/cskit-strongs/splitters/greek_lexicon_splitter.rb

Constant Summary collapse

LANG =
:greek

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#strip_zeroes

Constructor Details

#initialize(input_file) ⇒ GreekLexiconSplitter

Returns a new instance of GreekLexiconSplitter.



15
16
17
# File 'lib/cskit-strongs/splitters/greek_lexicon_splitter.rb', line 15

def initialize(input_file)
  @input_file = input_file
end

Instance Attribute Details

#input_fileObject (readonly)

Returns the value of attribute input_file.



13
14
15
# File 'lib/cskit-strongs/splitters/greek_lexicon_splitter.rb', line 13

def input_file
  @input_file
end

Instance Method Details

#eachObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cskit-strongs/splitters/greek_lexicon_splitter.rb', line 19

def each
  doc = parse_file(input_file)

  results = (doc / :entry).each do |entry|
    attrs = pronunciation_for(entry).
      merge(lang_attrs_for(entry, LANG)).
      merge(definition_for(entry))

    number = "g#{strip_zeroes(entry.attributes["strongs"].value)}"
    attrs.merge!(:strongs_number => number)

    yield number, attrs
  end
end