Class: Corrector::Prefix

Inherits:
Base
  • Object
show all
Defined in:
app/models/corrector/prefix.rb

Overview

Stores words translations.

Class Method Summary collapse

Class Method Details

.scan(value) ⇒ Object

Separates all prefixes in a scanned string.

@example:

Prefix.scan "КИЛОМЕТР" # => ["КИЛО", "^", "МЕТР"]

Params: value: a word to be scanned for prefixes and splitted

Returns an array of recognized word’s parts.



19
20
21
# File 'app/models/corrector/prefix.rb', line 19

def self.scan(value)
  all.reduce(value.dup) { |str, prefix| prefix.send :scan, str }.split(" ")
end