Class: CSKitStrongs::Splitters::HebrewLexiconSplitter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#strip_zeroes

Constructor Details

#initialize(input_file) ⇒ HebrewLexiconSplitter

Returns a new instance of HebrewLexiconSplitter.



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

def initialize(input_file)
  @input_file = input_file
end

Instance Attribute Details

#input_fileObject (readonly)

Returns the value of attribute input_file.



11
12
13
# File 'lib/cskit-strongs/splitters/hebrew_lexicon_splitter.rb', line 11

def input_file
  @input_file
end

Instance Method Details

#eachObject



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

def each
  doc = parse_file(input_file)

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

    number = strip_zeroes(entry.attributes["id"].value.downcase)
    attrs.merge!(:strongs_number => number)

    yield number, attrs
  end
end