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
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/nhkore/polisher.rb', line 26 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
15 16 17 |
# File 'lib/nhkore/polisher.rb', line 15 def begin_polish(str) return str end |
#polish(str) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/nhkore/polisher.rb', line 19 def polish(str) str = begin_polish(str) str = end_polish(str) return str end |