Class: ActiveMigration::SpellingFix
- Inherits:
-
Object
- Object
- ActiveMigration::SpellingFix
- Defined in:
- lib/active_migration/spelling_fix.rb
Instance Method Summary collapse
- #fix!(term) ⇒ Object
-
#initialize(url) ⇒ SpellingFix
constructor
A new instance of SpellingFix.
Constructor Details
#initialize(url) ⇒ SpellingFix
Returns a new instance of SpellingFix.
5 6 7 |
# File 'lib/active_migration/spelling_fix.rb', line 5 def initialize(url) @rules = YAML::load(File.open(url)) end |
Instance Method Details
#fix!(term) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/active_migration/spelling_fix.rb', line 9 def fix!(term) return term if term.nil? || term.empty? @rules.each do |before,after| term.gsub! before, after end term end |