Class: MedievalLatina::LexiconBuilder
- Inherits:
-
Object
- Object
- MedievalLatina::LexiconBuilder
- Includes:
- REXML
- Defined in:
- lib/medieval_latina/lexicon_builder.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(words) ⇒ LexiconBuilder
constructor
A new instance of LexiconBuilder.
Constructor Details
#initialize(words) ⇒ LexiconBuilder
Returns a new instance of LexiconBuilder.
8 9 10 11 |
# File 'lib/medieval_latina/lexicon_builder.rb', line 8 def initialize(words) @document = Document.new @words = words end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/medieval_latina/lexicon_builder.rb', line 13 def call document.add_element "lexicon", SPECIFICATION words.each do |word, pronunciation| lexeme = Element.new("lexeme") grapheme = Element.new("grapheme") phoneme = Element.new("phoneme") grapheme.text = CGI.unescapeHTML(word) phoneme.text = pronunciation lexeme.add_element(grapheme) lexeme.add_element(phoneme) document.root.add_element(lexeme) end document end |