Class: NHKore::Polisher
- Inherits:
-
Object
- Object
- NHKore::Polisher
- Defined in:
- lib/nhkore/polisher.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.polish_any(obj, polishers) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/nhkore/polisher.rb', line 28 def self.polish_any(obj,polishers) return nil if obj.nil? polishers = Array(polishers) return obj if polishers.empty? if obj.is_a?(Word) obj = Word.new( kana: polish_any(obj.kana,polishers), kanji: polish_any(obj.kanji,polishers), word: obj ) else # String polishers.each do |polisher| obj = polisher.polish(obj) end end return obj end |
Instance Method Details
#begin_polish(str) ⇒ Object
17 18 19 |
# File 'lib/nhkore/polisher.rb', line 17 def begin_polish(str) return str end |
#polish(str) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/nhkore/polisher.rb', line 21 def polish(str) str = begin_polish(str) str = end_polish(str) return str end |