Module: WordsCounted
- Defined in:
- lib/words_counted.rb,
lib/words_counted/counter.rb,
lib/words_counted/version.rb,
lib/words_counted/tokeniser.rb,
lib/words_counted/deprecated.rb
Defined Under Namespace
Modules: Deprecated
Classes: Counter, Tokeniser
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
.count(string, options = {}) ⇒ Object
14
15
16
17
|
# File 'lib/words_counted.rb', line 14
def self.count(string, options = {})
tokens = Tokeniser.new(string).tokenise(options)
Counter.new(tokens)
end
|
.from_file(path, options = {}) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/words_counted.rb', line 19
def self.from_file(path, options = {})
tokens = File.open(path) do |file|
Tokeniser.new(file.read).tokenise(options)
end
Counter.new(tokens)
end
|