Class: Smartdict::Translator::LanguageDetector::Matcher
- Inherits:
-
Object
- Object
- Smartdict::Translator::LanguageDetector::Matcher
- Defined in:
- lib/smartdict/translator/language_detector.rb
Instance Method Summary collapse
-
#initialize(chars) ⇒ Matcher
constructor
A new instance of Matcher.
- #match?(word) ⇒ Boolean
Constructor Details
#initialize(chars) ⇒ Matcher
Returns a new instance of Matcher.
61 62 63 |
# File 'lib/smartdict/translator/language_detector.rb', line 61 def initialize(chars) @chars = chars + [" ", "-"] end |
Instance Method Details
#match?(word) ⇒ Boolean
65 66 67 68 69 70 |
# File 'lib/smartdict/translator/language_detector.rb', line 65 def match?(word) word.each_char do |char| return false unless @chars.include? char end true end |