Module: Klee::Words
- Defined in:
- lib/klee/words.rb
Class Method Summary collapse
Class Method Details
.from(name, ignore: []) ⇒ Object
5 6 7 8 |
# File 'lib/klee/words.rb', line 5 def self.from(name, ignore: []) ignored = ignore.map(&:to_s) tokenize(name).reject { |word| word.empty? || ignored.include?(word) } end |
.tokenize(name) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/klee/words.rb', line 10 def self.tokenize(name) name.to_s .gsub("::", "_") .gsub(/([a-z\d])([A-Z])/, '\1_\2') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .downcase .gsub(/[?!=]/, "") .split(/[_\s]+/) end |