markov_words 0.2.1 → 0.2.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: 5dda90c58c74410faf33ed06402150326be2afe8
4
- data.tar.gz: 77cfaf41ef3314807e06b2ef12f5aa7bc42cbe4a
3
+ metadata.gz: 8178f4afd270e5707e65d66b6643e8b768be1026
4
+ data.tar.gz: 6bbe0d6c68c4a1f40719f204e0221cdf6723c358
5
5
  SHA512:
6
- metadata.gz: 14d952d8db7fe1f162bccf3c6ab9f1fcc389ff5cf91000f5f0bb87761860592148f4cd2bdc1fdb82e83ba9037316181f8c6987e10f62dc52c248037f5a902b7c
7
- data.tar.gz: 7ab05abcd9938125c56c76f82eec3eab0d46cc3588a4b120f9736830a19a334c988eac762a09360523128889654b76dad03002caf4c8be6ea4017d8ce6b9846f
6
+ metadata.gz: 3990ff760c7be9efa3953ca04b44173e4ba06329826e480c86a60b74d22b1664171696eac7ed58c85bedb2a9e7132059478d940b102af5befbfb1dab053eb98d
7
+ data.tar.gz: bcd4abb7a85dbd5e4337f86c731c2dbf7549cb02dd5ce9c55183bce6000b95fab230ad6f73ba2fc2ed47be2f7bb5d6294fa898f79e702b04b250907127ba2607
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markov_words (0.2.1)
4
+ markov_words (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # MarkovWords
2
+ [![Gem Version](https://badge.fury.io/rb/markov_words.svg)](https://badge.fury.io/rb/markov_words)
2
3
 
3
4
  At [EXPLO](https://www.explo.org), we often have a need for specific vocabulary-generators. For example, we might want to make a [password generator](http://lab.explo.org/password), or a Harry Potter house-generator, or some such thing.
4
5
 
@@ -1,4 +1,4 @@
1
1
  module MarkovWords
2
2
  # Current version
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.2.2'.freeze
4
4
  end
@@ -189,7 +189,8 @@ module MarkovWords
189
189
  # element from the values hash, accurate to the distribution of counts.
190
190
  # In the example hash above, "a" would have a 33% chance of being chosen,
191
191
  # while "b" would have a 66% chance (1/2 ratio).
192
- def pick_random_char(counts_hash = {})
192
+ def pick_random_char(counts_hash)
193
+ counts_hash ||= {}
193
194
  total = counts_hash.values.sum
194
195
  pick_num = SecureRandom.rand(total)
195
196
  counter = 0
@@ -200,7 +201,7 @@ module MarkovWords
200
201
  end
201
202
 
202
203
  def line_ending?(word)
203
- word.include?("\n")
204
+ word.match(/[\r \n]/)
204
205
  end
205
206
 
206
207
  def set_grams
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markov_words
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Merand
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2017-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler