Class: Phonology::OrthographyTranslator
- Inherits:
-
Object
- Object
- Phonology::OrthographyTranslator
- Includes:
- OrthographyTranslatorDSL
- Defined in:
- lib/phonology/orthography.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#scanner ⇒ Object
Returns the value of attribute scanner.
-
#sounds ⇒ Object
Returns the value of attribute sounds.
-
#string ⇒ Object
Returns the value of attribute string.
Attributes included from OrthographyTranslatorDSL
Instance Method Summary collapse
- #set_rules(&block) ⇒ Object
-
#translate(string) ⇒ Object
Translate orthorgraphy to IPA.
Methods included from OrthographyTranslatorDSL
#anticipate, #between, #context, #curr_char, #final?, #follows, #get, #initial?, #method_missing, #next_char, #offset, #precedes, #prev_char
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Phonology::OrthographyTranslatorDSL
Instance Attribute Details
#rules ⇒ Object
Returns the value of attribute rules.
90 91 92 |
# File 'lib/phonology/orthography.rb', line 90 def rules @rules end |
#scanner ⇒ Object
Returns the value of attribute scanner.
90 91 92 |
# File 'lib/phonology/orthography.rb', line 90 def scanner @scanner end |
#sounds ⇒ Object
Returns the value of attribute sounds.
90 91 92 |
# File 'lib/phonology/orthography.rb', line 90 def sounds @sounds end |
#string ⇒ Object
Returns the value of attribute string.
90 91 92 |
# File 'lib/phonology/orthography.rb', line 90 def string @string end |
Instance Method Details
#set_rules(&block) ⇒ Object
110 111 112 |
# File 'lib/phonology/orthography.rb', line 110 def set_rules(&block) @rules = block end |
#translate(string) ⇒ Object
Translate orthorgraphy to IPA
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/phonology/orthography.rb', line 95 def translate(string) @string = string @max = array.length SoundSequence.new(array.each_index.map do |index| @index = index instance_eval(&@rules) end.flatten.compact) ensure @max = 0 @string = nil @array = nil @index = nil @last_sound = nil end |