words_counted 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c56052462cafa83864d9f6ae8fcc9edcdd67356
4
- data.tar.gz: 562629bb6b6f61d45a2e40ae0fab5b07e749576e
3
+ metadata.gz: 9596a5852bcc4c417a62f4ec4aa2153eed7d4297
4
+ data.tar.gz: fad6c9456601aff8c709b1a385d9638e68140ac5
5
5
  SHA512:
6
- metadata.gz: 96a6ee9b686893bef4552aedd4dd05f696bf5735cb57c9de65b08f7a6ed6c0a4cbceddd27f8309d0f0522753ff0c556fa5b8ec7bf949a1c3c7c07d9ad1b11337
7
- data.tar.gz: 05251ab8e6efa3b29ebd88d7c5ddf82c20bfa3c07321a7a66a9f261c4b1162cdae600cd991b4b243c94d660fc2bfd45d779098f8dcda9f0165474965d8d5b9b8
6
+ metadata.gz: f0891409f8b63f89527fd68e8fed3ef2f917b9b342a0aabd6a00479627bea4ef2e9552810a25a4fd103529bc8cda846b9b50624c91437c0cf6a94b7e4e316c6c
7
+ data.tar.gz: 36c3c925b20388d86a5ef582e9ad09ca74b1f9fda8a9a66113ed5783d5123b2d99db342450a54e76278b41990c1301c6e31750ee7c5072aacf21e544147cd82c
@@ -1,6 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require "refinements/hash_refinements"
3
3
 
4
+ require "words_counted/deprecated"
5
+
4
6
  require "words_counted/tokeniser"
5
7
  require "words_counted/counter"
6
8
  require "words_counted/version"
@@ -11,11 +13,27 @@ rescue LoadError
11
13
  end
12
14
 
13
15
  module WordsCounted
14
- def self.count(string, options = {})
15
- tokens = Tokeniser.new(string).tokenise(options)
16
+ # Takes a string, tokenises it, and returns an instance of Counter
17
+ # with the resulting tokens.
18
+ #
19
+ # @see Tokeniser.tokenise
20
+ # @see Counter.initialize
21
+ #
22
+ # @param [String] input The input to be tokenised.
23
+ # @param [Hash] options The options to pass onto `Counter`.
24
+ def self.count(input, options = {})
25
+ tokens = Tokeniser.new(input).tokenise(options)
16
26
  Counter.new(tokens)
17
27
  end
18
28
 
29
+ # Takes a file path, reads the file and tokenises its contents,
30
+ # and returns an instance of Counter with the resulting tokens.
31
+ #
32
+ # @see Tokeniser.tokenise
33
+ # @see Counter.initialize
34
+ #
35
+ # @param [String] path The file to be read and tokenised.
36
+ # @param [Hash] options The options to pass onto `Counter`.
19
37
  def self.from_file(path, options = {})
20
38
  tokens = File.open(path) do |file|
21
39
  Tokeniser.new(file.read).tokenise(options)
@@ -1,7 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
-
3
- require "words_counted/deprecated"
4
-
5
2
  module WordsCounted
6
3
  using Refinements::HashRefinements
7
4
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module WordsCounted
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: words_counted
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohamad El-Husseini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-24 00:00:00.000000000 Z
11
+ date: 2015-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler