nerd_dice 0.3.0 → 0.3.1

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
  SHA256:
3
- metadata.gz: fa0fb8eebb2386727cce81ce7a3c301599322a3531db13f01329aa26225c88b3
4
- data.tar.gz: 205640e5b275ae107e0c2ee0ff1c10b777782f21c7a3c0ae7a5aac98e27f4841
3
+ metadata.gz: 6c50b3a0288e78cec77247885129b370ba6d88f7a012cfefd8fceed049363487
4
+ data.tar.gz: 456c3ff3d8816a567e4b80cbc49641811270483ce79cabf5fd8f4738bcd23722
5
5
  SHA512:
6
- metadata.gz: 0d275950feb1506a5a7602450690dab697c0ccd35b8d85a0869c4675c2dd714c85d2c744854ac7f69c7f204b1e55ecbf7e80f9209eb672ef4705d15fdbd10fd7
7
- data.tar.gz: fb8d5aa2297ecbf722b9242caf2680272a502d801dbd94fd53c6bd359a21a50e6e0e1096a5c5518a25a9ef842609c6db0af7c6b5273f4a1fd2e4f2f6089d393e
6
+ metadata.gz: fa26b32b8b95d4d926faa59071535b5958cc271ad190eea66a23a2fb25280c33c7d563962800a19f3f7c4947e130464450a76b8a59279b6fef9768278dbd61ec
7
+ data.tar.gz: faae3546363de7437f9425f08666ba934bdb5bb4bd626e4dd3cf4c33c85147453f080c7a42cc3a9d594dc8fdb2f976aecc909261a8533f5c348fa25ee2414bdd
checksums.yaml.gz.sig CHANGED
Binary file
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- ruby-version: ['2.7', '3.0']
17
+ ruby-version: ['3.0', '3.1', '3.2']
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v2
@@ -39,7 +39,7 @@ jobs:
39
39
  - name: Set up Ruby
40
40
  uses: ruby/setup-ruby@v1
41
41
  with:
42
- ruby-version: '3.0'
42
+ ruby-version: '3.2'
43
43
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
44
44
  - name: Run rubocop
45
45
  run: bundle exec rubocop --parallel
@@ -51,7 +51,7 @@ jobs:
51
51
  - name: Set up Ruby
52
52
  uses: ruby/setup-ruby@v1
53
53
  with:
54
- ruby-version: '3.0'
54
+ ruby-version: '3.2'
55
55
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
56
56
  - name: Run benchmark script
57
57
  run: bin/nerd_dice_benchmark
data/.rubocop.yml CHANGED
@@ -1,3 +1,11 @@
1
+ # RuboCop configuration file for NerdDice gem
2
+ #
3
+ # This is the RuboCop configuration for the gem. By default new cops are enabled
4
+ # by default when the RuboCop gems are updated in the bundle. Before the would
5
+ # show up as warnings until they were added to the configuration file. Now they
6
+ # will be enabled by default, and a case-by-case descision can be made whether
7
+ # to exclude new violations in the configuration explicitly or update the
8
+ # codebase to the gem to conform to the new standard.
1
9
  require:
2
10
  - rubocop-performance
3
11
  - rubocop-rake
@@ -8,14 +16,12 @@ AllCops:
8
16
  # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
9
17
  # to ignore them, so only the ones explicitly set in this file are enabled.
10
18
  #DisabledByDefault: true
19
+
20
+ # New cops are now enabled by default as of 2023-02-20
21
+ NewCops: enable
11
22
  Exclude:
12
23
  - '**/templates/**/*'
13
24
  - '**/vendor/**/*'
14
- - 'node_modules/**/*'
15
-
16
- Performance:
17
- Exclude:
18
- - '**/test/**/*'
19
25
 
20
26
  # Prefer &&/|| over and/or.
21
27
  Style/AndOr:
@@ -111,15 +117,6 @@ Style/MethodDefParentheses:
111
117
  Style/FrozenStringLiteralComment:
112
118
  Enabled: true
113
119
  EnforcedStyle: always
114
- Exclude:
115
- - 'actionview/test/**/*.builder'
116
- - 'actionview/test/**/*.ruby'
117
- - 'actionpack/test/**/*.builder'
118
- - 'actionpack/test/**/*.ruby'
119
- - 'activestorage/db/migrate/**/*.rb'
120
- - 'activestorage/db/update_migrate/**/*.rb'
121
- - 'actionmailbox/db/migrate/**/*.rb'
122
- - 'actiontext/db/migrate/**/*.rb'
123
120
 
124
121
  Style/RedundantFreeze:
125
122
  Enabled: true
@@ -191,30 +188,6 @@ Lint/UselessAssignment:
191
188
  Lint/DeprecatedClassMethods:
192
189
  Enabled: true
193
190
 
194
- Lint/DuplicateBranch: # (new in 1.3)
195
- Enabled: true
196
-
197
- Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
198
- Enabled: true
199
-
200
- Lint/EmptyBlock: # (new in 1.1)
201
- Enabled: true
202
-
203
- Lint/EmptyClass: # (new in 1.3)
204
- Enabled: true
205
-
206
- Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
207
- Enabled: true
208
-
209
- Lint/ToEnumArguments: # (new in 1.1)
210
- Enabled: true
211
-
212
- Lint/UnexpectedBlockArity: # (new in 1.5)
213
- Enabled: true
214
-
215
- Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
216
- Enabled: true
217
-
218
191
  Style/ParenthesesAroundCondition:
219
192
  Enabled: true
220
193
 
@@ -236,27 +209,6 @@ Style/ColonMethodCall:
236
209
  Style/TrivialAccessors:
237
210
  Enabled: true
238
211
 
239
- Style/ArgumentsForwarding: # (new in 1.1)
240
- Enabled: true
241
-
242
- Style/CollectionCompact: # (new in 1.2)
243
- Enabled: true
244
-
245
- Style/DocumentDynamicEvalDefinition: # (new in 1.1)
246
- Enabled: true
247
-
248
- Style/NegatedIfElseCondition: # (new in 1.2)
249
- Enabled: true
250
-
251
- Style/NilLambda: # (new in 1.3)
252
- Enabled: true
253
-
254
- Style/RedundantArgument: # (new in 1.4)
255
- Enabled: true
256
-
257
- Style/SwapValues: # (new in 1.1)
258
- Enabled: true
259
-
260
212
  Performance/FlatMap:
261
213
  Enabled: true
262
214
 
@@ -275,128 +227,9 @@ Performance/RegexpMatch:
275
227
  Performance/UnfreezeString:
276
228
  Enabled: true
277
229
 
278
- Performance/AncestorsInclude: # (new in 1.7)
279
- Enabled: true
280
-
281
- Performance/BigDecimalWithNumericArgument: # (new in 1.7)
282
- Enabled: true
283
-
284
- Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
285
- Enabled: true
286
-
287
- Performance/CollectionLiteralInLoop: # (new in 1.8)
288
- Enabled: true
289
-
290
- Performance/ConstantRegexp: # (new in 1.9)
291
- Enabled: true
292
-
293
- Performance/MethodObjectAsBlock: # (new in 1.9)
294
- Enabled: true
295
-
296
- Performance/RedundantSortBlock: # (new in 1.7)
297
- Enabled: true
298
-
299
- Performance/RedundantStringChars: # (new in 1.7)
300
- Enabled: true
301
-
302
- Performance/ReverseFirst: # (new in 1.7)
303
- Enabled: true
304
-
305
- Performance/SortReverse: # (new in 1.7)
306
- Enabled: true
307
-
308
- Performance/Squeeze: # (new in 1.7)
309
- Enabled: true
310
-
311
- Performance/StringInclude: # (new in 1.7)
312
- Enabled: true
313
-
314
- Performance/Sum: # (new in 1.8)
315
- Enabled: true
316
-
317
- Layout/SpaceBeforeBrackets: # (new in 1.7)
318
- Enabled: true
319
-
320
- Lint/AmbiguousAssignment: # (new in 1.7)
321
- Enabled: true
322
-
323
- Lint/DeprecatedConstants: # (new in 1.8)
324
- Enabled: true
325
-
326
- Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
327
- Enabled: true
328
-
329
- Lint/RedundantDirGlobSort: # (new in 1.8)
330
- Enabled: true
331
-
332
- Style/EndlessMethod: # (new in 1.8)
333
- Enabled: true
334
-
335
- Style/HashExcept: # (new in 1.7)
336
- Enabled: true
337
-
338
- # Added 2021-08-14
339
- Gemspec/DateAssignment: # (new in 1.10)
340
- Enabled: true
341
-
342
- Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
343
- Enabled: true
344
-
345
- Lint/EmptyInPattern: # (new in 1.16)
346
- Enabled: true
347
-
348
- Lint/NumberedParameterAssignment: # (new in 1.9)
349
- Enabled: true
350
-
351
- Lint/OrAssignmentToConstant: # (new in 1.9)
352
- Enabled: true
353
-
354
- Lint/SymbolConversion: # (new in 1.9)
355
- Enabled: true
356
-
357
- Lint/TripleQuotes: # (new in 1.9)
358
- Enabled: true
359
-
360
- Naming/InclusiveLanguage: # (new in 1.18)
361
- Enabled: false
362
-
363
- Style/HashConversion: # (new in 1.10)
364
- Enabled: true
365
-
366
- Style/IfWithBooleanLiteralBranches: # (new in 1.9)
367
- Enabled: true
368
-
369
- Style/InPatternThen: # (new in 1.16)
370
- Enabled: true
371
-
372
- Style/MultilineInPatternThen: # (new in 1.16)
373
- Enabled: true
374
-
375
- Style/QuotedSymbols: # (new in 1.16)
376
- Enabled: true
377
-
378
- Style/StringChars: # (new in 1.12)
379
- Enabled: true
380
-
381
- Performance/MapCompact: # (new in 1.11)
382
- Enabled: true
383
-
384
- Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
385
- Enabled: true
386
-
387
- Performance/RedundantSplitRegexpArgument: # (new in 1.10)
388
- Enabled: true
389
-
390
- RSpec/IdenticalEqualityAssertion: # (new in 2.4)
391
- Enabled: true
392
-
393
- RSpec/Rails/AvoidSetupHook: # (new in 2.4)
394
- Enabled: true
395
-
396
230
  RSpec/MessageSpies:
397
231
  EnforcedStyle: receive
398
232
 
399
- Lint/AmbiguousRange: # new in 1.19
400
- Enabled: true
401
- Style/RedundantSelfAssignmentBranch: # new in 1.19
402
- Enabled: true
233
+ # Disable inclusive language cop. None of RuboCop's business
234
+ Naming/InclusiveLanguage:
235
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,70 +1,8 @@
1
1
  # Nerd Dice Changelog
2
2
 
3
- ## master \(unreleased\)
4
- ### Added
5
- ### Changed
6
- ### Fixed
3
+ <img src="https://i.kym-cdn.com/photos/images/newsfeed/000/186/610/thankyou.png?1318726198" alt="Our CHANGELOG is in another castle" />
7
4
 
8
- ## 0.3.0 \(2021-09-11\)
9
- ### Added
10
- * Add new options to `NerdDice::Configuration`
11
- - `ability_score_number_of_sides`
12
- - `ability_score_dice_rolled`
13
- - `ability_score_dice_kept`
14
- * Add `NerdDice.harvest_totals` method that takes in a collection and returns the results of calling `total` on each element
15
- * Add `NerdDice.roll_ability_scores` convenience method that returns an array of `DiceSet` objects based on options and/or configuration
16
- * Add `NerdDice.total_ability_scores` convenience method that returns an array of integers based on options and/or configuration
17
- * Add `NerdDice::Die` class that represents a single die object and mixes in the `Comparable` module
18
- * Add `NerdDice::DiceSet` class that represents a collection of `Die` objects and mixes in the `Enumerable` module
19
- * Add `NerdDice::SetsRandomizationTechnique` mixin module and include in the `DiceSet` and `Die` classes
20
- * Add `die_background_color` and `die_foreground_color` to `Configuration` class with defaults defined as constants
21
- * Add `NerdDice.roll_dice` method that behaves in a similar fashion to `total_dice` but returns a `DiceSet` object instead of an `Integer` and has additional optional arguments relating to the non-numeric attributes of the dice
22
- * Add `coveralls_reborn` to RSpec and GitHub actions
23
- * Add build badge to README
24
- * Add Code Climate maintainability integration and badge to README
25
- * Add `nerd_dice_benchmark` script to bin directory
26
- * Add GitHub Action CI build
27
- - Run RSpec test suite, fail if specs fail, report coverage via Coveralls
28
- - Run RuboCop and fail if violations
29
- - Run benchmark suite and fail if outside of allowed ratios
30
- ### Changed
31
- * Update RuboCop version and configuration
32
- * Break up the NerdDice source code file into several smaller files that are included by the module
33
- * Enforce that `NerdDice.configuration.ability_score_array_size` must be a positive duck-type integer
34
- ### Fixed
5
+ ## Legacy Branch: See master
6
+ This is a legacy maintenance branch.
35
7
 
36
- ## 0.2.0 \(2021-01-28\)
37
- ### Added
38
- * Add ability to configure with `NerdDice.configure` block or `NerdDice.configuration`
39
- - Configure `randomization_technique` as `:random_rand`, `:securerandom`, `:random_object`, or `randomized`
40
- - Configure `refresh_seed_interval` to allow a periodic refresh of the seed
41
- * Add `randomization_technique` option to `NerdDice.total_dice` method keyword arguments
42
- * Add a lower-level `execute_die_roll` method that allows you to roll a single die with a generator specified
43
- * Add ability to manually refresh or specify seed with `:refresh_seed!` method
44
- ### Changed
45
- * Change `opts = {}` final argument to use keyword args `**opts` in the `NerdDice.total_dice` method. Now the method can be called as follows:
46
- ```ruby
47
- # old
48
- NerdDice.total_dice(20, 1, {bonus: 5})
49
- NerdDice.total_dice(6, 3, {bonus: 1})
50
-
51
- # new
52
- NerdDice.total_dice(20, bonus: 5)
53
- NerdDice.total_dice(6, 3, bonus: 1)
54
- ```
55
- * Call `:to_i` on bonus instead of using `:is_a?` and raise ArgumentError in the `NerdDice.total_dice` method if it doesn't respond to `:to_i`
56
- * Added `securerandom` as an explicit dependency due to Ruby 3.x change to bundled gem
57
- * `total_dice` no longer calls unqualified `.rand` which improves performance on all generators except for `:securerandom`
58
- ### Fixed
59
-
60
- ## 0.1.1 \(2020-12-12\)
61
- ### Added
62
- ### Changed
63
- ### Fixed
64
- * Fix broken link to CHANGELOG in gemspec
65
- * Fix rubocop offenses from 0.1.0 and refactor specs
66
-
67
- ## 0.1.0 \(2020-12-07\)
68
-
69
- ### Added
70
- * Add NerdDice.total_dice class method with the ability to roll multiple polyhedral dice and add a bonus
8
+ The [authoritative version of the CHANGELOG](https://github.com/statelesscode/nerd_dice/blob/master/CHANGELOG.md) is found on the master branch. All other release and maintenance branches are updated to point to master after being created.
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in nerd_dice.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 12.0"
9
- gem "rspec", "~> 3.0"
8
+ gem "rake", "~> 13.0"
9
+ gem "rspec", "~> 3.12"
data/Gemfile.lock CHANGED
@@ -1,88 +1,92 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nerd_dice (0.3.0)
5
- securerandom (~> 0.1, >= 0.1.0)
4
+ nerd_dice (0.3.1)
5
+ securerandom (~> 0.2, >= 0.2.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.2)
11
- coveralls_reborn (0.22.0)
12
- simplecov (>= 0.18.1, < 0.22.0)
13
- term-ansicolor (~> 1.6)
14
- thor (>= 0.20.3, < 2.0)
15
- tins (~> 1.16)
16
- diff-lcs (1.4.4)
11
+ coveralls_reborn (0.27.0)
12
+ simplecov (~> 0.22.0)
13
+ term-ansicolor (~> 1.7)
14
+ thor (~> 1.2)
15
+ tins (~> 1.32)
16
+ diff-lcs (1.5.0)
17
17
  docile (1.4.0)
18
- parallel (1.20.1)
19
- parser (3.0.2.0)
18
+ json (2.6.3)
19
+ parallel (1.22.1)
20
+ parser (3.2.1.0)
20
21
  ast (~> 2.4.1)
21
- rainbow (3.0.0)
22
- rake (12.3.3)
23
- regexp_parser (2.1.1)
22
+ rainbow (3.1.1)
23
+ rake (13.0.6)
24
+ regexp_parser (2.7.0)
24
25
  rexml (3.2.5)
25
- rspec (3.10.0)
26
- rspec-core (~> 3.10.0)
27
- rspec-expectations (~> 3.10.0)
28
- rspec-mocks (~> 3.10.0)
29
- rspec-core (3.10.1)
30
- rspec-support (~> 3.10.0)
31
- rspec-expectations (3.10.1)
26
+ rspec (3.12.0)
27
+ rspec-core (~> 3.12.0)
28
+ rspec-expectations (~> 3.12.0)
29
+ rspec-mocks (~> 3.12.0)
30
+ rspec-core (3.12.1)
31
+ rspec-support (~> 3.12.0)
32
+ rspec-expectations (3.12.2)
32
33
  diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.10.0)
34
- rspec-mocks (3.10.2)
34
+ rspec-support (~> 3.12.0)
35
+ rspec-mocks (3.12.3)
35
36
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.10.0)
37
- rspec-support (3.10.2)
38
- rubocop (1.20.0)
37
+ rspec-support (~> 3.12.0)
38
+ rspec-support (3.12.0)
39
+ rubocop (1.46.0)
40
+ json (~> 2.3)
39
41
  parallel (~> 1.10)
40
- parser (>= 3.0.0.0)
42
+ parser (>= 3.2.0.0)
41
43
  rainbow (>= 2.2.2, < 4.0)
42
44
  regexp_parser (>= 1.8, < 3.0)
43
- rexml
44
- rubocop-ast (>= 1.9.1, < 2.0)
45
+ rexml (>= 3.2.5, < 4.0)
46
+ rubocop-ast (>= 1.26.0, < 2.0)
45
47
  ruby-progressbar (~> 1.7)
46
- unicode-display_width (>= 1.4.0, < 3.0)
47
- rubocop-ast (1.11.0)
48
- parser (>= 3.0.1.1)
49
- rubocop-performance (1.11.5)
48
+ unicode-display_width (>= 2.4.0, < 3.0)
49
+ rubocop-ast (1.26.0)
50
+ parser (>= 3.2.1.0)
51
+ rubocop-capybara (2.17.1)
52
+ rubocop (~> 1.41)
53
+ rubocop-performance (1.16.0)
50
54
  rubocop (>= 1.7.0, < 2.0)
51
55
  rubocop-ast (>= 0.4.0)
52
56
  rubocop-rake (0.6.0)
53
57
  rubocop (~> 1.0)
54
- rubocop-rspec (2.4.0)
55
- rubocop (~> 1.0)
56
- rubocop-ast (>= 1.1.0)
58
+ rubocop-rspec (2.18.1)
59
+ rubocop (~> 1.33)
60
+ rubocop-capybara (~> 2.17)
57
61
  ruby-progressbar (1.11.0)
58
- securerandom (0.1.0)
59
- simplecov (0.21.2)
62
+ securerandom (0.2.2)
63
+ simplecov (0.22.0)
60
64
  docile (~> 1.1)
61
65
  simplecov-html (~> 0.11)
62
66
  simplecov_json_formatter (~> 0.1)
63
67
  simplecov-html (0.12.3)
64
68
  simplecov-lcov (0.8.0)
65
- simplecov_json_formatter (0.1.3)
69
+ simplecov_json_formatter (0.1.4)
66
70
  sync (0.5.0)
67
71
  term-ansicolor (1.7.1)
68
72
  tins (~> 1.0)
69
- thor (1.1.0)
70
- tins (1.29.1)
73
+ thor (1.2.1)
74
+ tins (1.32.1)
71
75
  sync
72
- unicode-display_width (2.0.0)
76
+ unicode-display_width (2.4.2)
73
77
 
74
78
  PLATFORMS
75
79
  ruby
76
80
 
77
81
  DEPENDENCIES
78
- coveralls_reborn (~> 0.22.0)
82
+ coveralls_reborn (~> 0.27.0)
79
83
  nerd_dice!
80
- rake (~> 12.0)
81
- rspec (~> 3.0)
82
- rubocop (~> 1.20, >= 1.20.0)
83
- rubocop-performance (~> 1.11, >= 1.11.5)
84
+ rake (~> 13.0)
85
+ rspec (~> 3.12)
86
+ rubocop (~> 1.46, >= 1.46.0)
87
+ rubocop-performance (~> 1.16, >= 1.16.0)
84
88
  rubocop-rake (~> 0.6, >= 0.6.0)
85
- rubocop-rspec (~> 2.4, >= 2.4.0)
89
+ rubocop-rspec (~> 2.18, >= 2.18.1)
86
90
  simplecov-lcov (~> 0.8.0)
87
91
 
88
92
  BUNDLED WITH
data/README.md CHANGED
@@ -39,7 +39,9 @@ NerdDice.configure do | config|
39
39
  # total number of dice rolled for each ability score
40
40
  config.ability_score_dice_rolled = 4 # must duck-type to positive Integer
41
41
 
42
- # highest(n) dice from the total number of dice rolled that are included in the ability score total
42
+ # highest(n) dice from the total number of dice rolled
43
+ # that are included in the ability scoretotal
44
+ #
43
45
  # CANNOT EXCEED ability_score_dice_rolled see Note below
44
46
  config.ability_score_dice_kept = 3 # must duck-type to positive Integer
45
47
 
@@ -49,14 +51,16 @@ NerdDice.configure do | config|
49
51
  # (Seed is shared with other processes. Too predictable)
50
52
  # :random_object => Uses Random.new() and calls rand()
51
53
  # Medium entropy, fastest speed. (Performs the best under speed benchmark)
52
- # :randomized => Uses a random choice of the :securerandom, :rand, and :random_new_interval options above
54
+ # :randomized =>
55
+ # Uses a random choice of the :securerandom, :rand, and :random_new_interval options above
53
56
  config.randomization_technique = :random_object # fast with independent seed
54
57
 
55
58
  # Number of iterations to use on a generator before refreshing the seed
56
59
  # 1 very slow and heavy pressure on processor and memory but very high entropy
57
60
  # 1000 would refresh the object every 1000 times you call rand()
58
61
  config.refresh_seed_interval = nil # don't refresh the seed
59
- # Background and foreground die colors are string values. By default these correspond to the constants in the class
62
+ # Background and foreground die colors are string values.
63
+ # By default these correspond to the constants in the class
60
64
  # Defaults: DEFAULT_BACKGROUND_COLOR = "#0000DD" DEFAULT_FOREGROUND_COLOR = "#DDDDDD"
61
65
  # It is recommended but not enforced that these should be valid CSS color property attributes
62
66
  config.die_background_color = "red"
@@ -70,25 +74,26 @@ You can use two different methods to roll dice. The `total_dice` method returns
70
74
 
71
75
  ```ruby
72
76
  # roll a single d4
73
- NerdDice.total_dice(4) # => return random Integer between 1-4
74
- NerdDice.roll_dice(4) # => return a DiceSet with one 4-sided Die with a value between 1-4
75
- NerdDice.roll_dice(4).total # => return random Integer between 1-4
77
+ NerdDice.total_dice(4) # => Integer: between 1-4
78
+ NerdDice.roll_dice(4) # => DiceSet: with one 4-sided Die with a value between 1-4
79
+ NerdDice.roll_dice(4).total # => Integer: between 1-4
76
80
 
77
81
  # roll 3d6
78
- NerdDice.total_dice(6, 3) # => return Integer total of three 6-sided dice
79
- NerdDice.roll_dice(6, 3) # => return a DiceSet with three 6-sided Die objects, each with values between 1-6
80
- NerdDice.roll_dice(6, 3).total # => return Integer total of three 6-sided dice
82
+ NerdDice.total_dice(6, 3) # => Integer: total of three 6-sided dice
83
+ NerdDice.roll_dice(6, 3) # => DiceSet: three 6-sided Die objects, each with values between 1-6
84
+ NerdDice.roll_dice(6, 3).total # => Integer: total of three 6-sided dice
81
85
 
82
86
  # roll a d20 and add 5 to the value
83
- NerdDice.total_dice(20, bonus: 5) # rolls a d20 and adds the bonus to the total => Integer
84
- NerdDice.roll_dice(20, bonus: 5) # return a DiceSet with one 20-sided Die with a value between 1-20 and a bonus attribute of 5
85
- NerdDice.roll_dice(20, bonus: 5).total # rolls a d20 and adds the bonus to the total => Integer
87
+ NerdDice.total_dice(20, bonus: 5) # => Integer: roll a d20 and add the bonus to the total
88
+ NerdDice.roll_dice(20, bonus: 5) # => DiceSet: one 20-sided Die and bonus of 5
89
+ NerdDice.roll_dice(20, bonus: 5).total # => Integer: roll a d20 and add the bonus to the total
86
90
 
87
91
  # without changing the config at the module level
88
92
  # roll a d20 and overide the configured randomization_technique one time
89
93
  NerdDice.total_dice(20, randomization_technique: :randomized) # => Integer
90
- # roll a d20 and overide the configured randomization_technique for the DiceSet object will persist on the DiceSet object for subsequent rerolls
91
- NerdDice.roll_dice(20, randomization_technique: :randomized) # => DiceSet with randomization_technique: :randomized
94
+ # roll a d20 and overide the configured randomization_technique for the DiceSet
95
+ # object will persist on the DiceSet object for subsequent rerolls
96
+ NerdDice.roll_dice(20, randomization_technique: :randomized) # => DiceSet with :randomized
92
97
  ```
93
98
  __NOTE:__ If provided, the bonus must respond to `:to_i` or an `ArgumentError` will be raised
94
99
 
@@ -96,26 +101,29 @@ __NOTE:__ If provided, the bonus must respond to `:to_i` or an `ArgumentError` w
96
101
  The `NerdDice.roll_dice` method or the `NerdDice::DiceSet.new` methods return a collection object with an array of one or more `Die` objects. There are properties on both the `DiceSet` object and the `Die` object. Applicable properties are cascaded from the `DiceSet` to the `Die` objects in the collection by default.
97
102
 
98
103
  ```ruby
99
- # These are equivalent
100
- dice_set = NerdDice.roll_dice(6, 3, bonus: 2, randomization_technique: :randomized, damage_type: 'psychic', foreground_color: '#FFF', background_color: '#0FF')
101
- # => NerdDice::DiceSet
102
- dice_set = NerdDice::DiceSet.new(6, 3, bonus: 2, randomization_technique: :randomized, damage_type: 'psychic', foreground_color: '#FFF', background_color: '#0FF')
103
- # => NerdDice::DiceSet
104
+ # These are equivalent. Both return a NerdDice::DiceSet
105
+ dice_set = NerdDice.roll_dice(6, 3, bonus: 2, randomization_technique: :randomized,
106
+ damage_type: 'psychic', foreground_color: '#FFF', background_color: '#0FF')
107
+
108
+ dice_set = NerdDice::DiceSet.new(6, 3, bonus: 2, randomization_technique: :randomized,
109
+ damage_type: 'psychic', foreground_color: '#FFF', background_color: '#0FF')
110
+
104
111
  ```
105
112
  #### Available options for NerdDice::DiceSet objects
106
113
  There are a number of options that can be provided when initializing a `NerdDice::DiceSet` object after specifying the mandatory number of sides and the optional number of dice \(default: 1\). The list below provides the options and indicates whether they are cascaded to the Die objects in the collection.
107
114
  * `bonus` \(Duck-type Integer, _default: 0_\): Bonus or penalty to apply to the total after all dice are rolled. _**Not applied** to Die objects_
108
- * `randomization_technique` \(Symbol, _default: nil_\): Randomization technique override to use for the `DiceSet`. If `nil` it will use the value in `NerdDice.configuration`. _**Applied** to Die objects by default with ability modify_
109
- * `damage_type` \(String, _default: nil_\): Optional string indicating the damage type associated with the dice for systems where it is relevant. _**Applied** to Die objects by default with ability modify_
110
- * `foreground_color` \(String, _default: `NerdDice.configuration.die_foreground_color`_\): Intended foreground color to apply to the dice in the `DiceSet`. Should be a valid CSS color but is not validated or enforced and doesn\'t currently have any real functionality associated with it. _**Applied** to Die objects by default with ability modify_
111
- * `background_color` \(String, _default: `NerdDice.configuration.die_background_color`_\): Intended background color to apply to the dice in the `DiceSet`. Should be a valid CSS color but is not validated or enforced and doesn\'t currently have any real functionality associated with it. _**Applied** to Die objects by default with ability modify_
115
+ * `randomization_technique` \(Symbol, _default: nil_\): Randomization technique override to use for the `DiceSet`. If `nil` it will use the value in `NerdDice.configuration`. _**Applied** to Die objects by default with ability to modify_
116
+ * `damage_type` \(String, _default: nil_\): Optional string indicating the damage type associated with the dice for systems where it is relevant. _**Applied** to Die objects by default with ability to modify_
117
+ * `foreground_color` \(String, _default: `NerdDice.configuration.die_foreground_color`_\): Intended foreground color to apply to the dice in the `DiceSet`. Should be a valid CSS color but is not validated or enforced and doesn\'t currently have any real functionality associated with it. _**Applied** to Die objects by default with ability to modify_
118
+ * `background_color` \(String, _default: `NerdDice.configuration.die_background_color`_\): Intended background color to apply to the dice in the `DiceSet`. Should be a valid CSS color but is not validated or enforced and doesn\'t currently have any real functionality associated with it. _**Applied** to Die objects by default with ability to modify_
112
119
 
113
120
  #### Properties of individual Die objects
114
121
  When initialized from a `DiceSet` object most of the properties of the `Die` object are inherited from the `DiceSet` object. In addition, there is an `is_included_in_total` public attribute that can be set to indicate whether the value of that particular die should be included in the total for its parent `DiceSet`. This property always starts out as true when the `Die` is initialized, but can be set to false.
115
122
 
116
123
  ```ruby
117
124
  # six sided die
118
- die = NerdDice::Die.new(6, randomization_technique: :randomized, damage_type: 'psychic', foreground_color: '#FFF', background_color: '#0FF')
125
+ die = NerdDice::Die.new(6, randomization_technique: :randomized, damage_type: 'psychic',
126
+ foreground_color: '#FFF', background_color: '#0FF')
119
127
  die.is_included_in_total # => true
120
128
  die.included_in_total? # => true
121
129
  die.is_included_in_total = false
@@ -123,9 +131,11 @@ die.included_in_total? # => false
123
131
 
124
132
  # value property
125
133
  die.value # => Integer between 1 and number_of_sides
126
- die.roll # => Integer. Rolls/rerolls the Die and sets value to the result of the roll. Returns the new value
134
+
135
+ # Rolls/rerolls the Die, sets value to the result of the roll, and returns the new value
136
+ die.roll # => Integer.
127
137
  ```
128
- #### Iterating through dices in a DiceSet
138
+ #### Iterating through dice in a DiceSet
129
139
  The `DiceSet` class mixes in the `Enumerable` module and the `Die` object mixes in the `Comparable` module. This allows you to iterate over the dice in the collection. The `sort` method on the dice will return the die objects in ascending value from lowest to highest.
130
140
 
131
141
  ```ruby
@@ -155,23 +165,31 @@ Since the DiceSet is an object, you can call methods that operate on the result
155
165
  # assuming 4d6 with values of [1, 3, 4, 6]
156
166
  ##############################################
157
167
  dice_set = NerdDice.roll_dice(6, 4)
168
+
158
169
  # the 6, 4, and 3 will have is_included_in_total true while the 1 has it false
159
- dice_set.highest(3) # => Returns the existing DiceSet object with the changes made to dice inclusion
160
- dice_set.with_advantage(3) # => Alias of highest method
170
+ # Returns the existing DiceSet object with the changes made to dice inclusion
171
+ dice_set.highest(3) # => DiceSet
172
+ dice_set.with_advantage(3) # => DiceSet (Alias of highest method)
173
+
161
174
  # calling total after highest/with_advantage for this DiceSet
162
175
  dice_set.total # => 13
163
- # same DiceSet using lowest. The 1, 3, and 4 will have is_included_in_total true while the 6 has it false
164
- dice_set.lowest(3) # => Returns the existing DiceSet object with the changes made to dice inclusion
165
- dice_set.with_disadvantage(3) # => Alias of lowest method
176
+
177
+ # same DiceSet using lowest.
178
+ # The 1, 3, and 4 will have is_included_in_total true while the 6 has it false
179
+ dice_set.lowest(3) # => DiceSet
180
+ dice_set.with_disadvantage(3) # => DiceSet (Alias of lowest method)
181
+
166
182
  # calling total after lowest/with_disadvantage for this DiceSet
167
183
  dice_set.total # => 8
184
+
168
185
  # you can chain these methods (assumes the same seed as the above examples)
169
186
  NerdDice.roll_dice(6, 4).with_advantage(3).total # => 13
170
187
  NerdDice.roll_dice(6, 4).lowest(3).total # => 8
171
188
 
172
189
  # reroll_all! method
173
190
  dice_set = NerdDice.roll_dice(6, 4)
174
- dice_set.reroll_all! # rerolls each of the Die objects in the collection and re-includes them in the total
191
+ # rerolls each of the Die objects in the collection and re-includes them in the total
192
+ dice_set.reroll_all!
175
193
 
176
194
  # include_all_dice! method
177
195
  dice_set.include_all_dice! # resets is_included_in_total to true for all Die objects
@@ -232,7 +250,7 @@ NerdDice.refresh_seed!(randomization_technique: :randomized,
232
250
  random_rand_seed: 1337,
233
251
  random_object_seed: 24601)
234
252
  ```
235
- __NOTE:__ Ability to specify a seed it primarily provided for testing purposes. This makes all random numbers generated _transparently deterministic_ and should not be used if you want behavior approximating randomness.
253
+ __NOTE:__ Ability to specify a seed is primarily provided for testing purposes. This makes all random numbers generated _transparently deterministic_ and should not be used if you want behavior approximating randomness.
236
254
 
237
255
  ### Utility Methods
238
256
 
@@ -259,9 +277,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
259
277
 
260
278
  ## Contributing
261
279
 
262
- Bug reports and pull requests are welcome on GitHub at https://github.com/statelesscode/nerd_dice/issues. We welcome and encourage your participation in this open-source project. We welcome those of all backgrounds and abilities, but we refuse to adopt the Contributor Covenant for reasons outlined in [BURN_THE_CONTRIBUTOR_COVENANT_WITH_FIRE.md](https://github.com/statelesscode/nerd_dice/blob/master/BURN_THE_CONTRIBUTOR_COVENANT_WITH_FIRE.md)
263
-
280
+ Bug reports and pull requests are welcome on GitHub at https://github.com/statelesscode/nerd_dice/issues. We welcome and encourage your participation in this open-source project. We welcome those of all backgrounds and abilities, but we refuse to adopt the Contributor Covenant for reasons outlined in [BURN_THE_CONTRIBUTOR_COVENANT_WITH_FIRE.md](BURN_THE_CONTRIBUTOR_COVENANT_WITH_FIRE.md)
264
281
 
265
282
  ## Unlicense, License, and Copyright
266
283
 
267
- The document is dual-licensed under the [MIT](https://opensource.org/licenses/MIT) license and the [UNLICENSE](https://unlicense.org/) \(with strong preference toward the UNLICENSE\)\. The content is released under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/) \(no rights reserved\). You are free to include it in its original form or modified with or without additional modification in your own project\.
284
+ The project is dual-licensed under the [MIT](https://opensource.org/licenses/MIT) license and the [UNLICENSE](https://unlicense.org/) \(with strong preference toward the UNLICENSE\)\. The content is released under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/) \(no rights reserved\). You are free to include it in its original form or modified with or without additional modification in your own project\.
@@ -7,7 +7,7 @@ version = ARGV[0]
7
7
  built_gem_path = "pkg/nerd_dice-#{version}.gem"
8
8
  checksum = Digest::SHA512.new.hexdigest(File.read(built_gem_path))
9
9
  checksum_path = "checksum/nerd_dice-#{version}.gem.sha512"
10
- File.open(checksum_path, "w") { |f| f.write(checksum) }
10
+ File.write(checksum_path, checksum)
11
11
  sha256 = Digest::SHA256.new.hexdigest(File.read(built_gem_path))
12
12
  checksum_256_path = "checksum/nerd_dice-#{version}.gem.sha256"
13
- File.open(checksum_256_path, "w") { |f| f.write(sha256) }
13
+ File.write(checksum_256_path, sha256)
@@ -24,8 +24,8 @@ RATIOS = {
24
24
  roll_dice_random_rand_3d6: 79.0,
25
25
  roll_dice_random_object_3d6: 86.0,
26
26
  roll_dice_randomized_3d6: 26.5,
27
- roll_ability_scores_randomized: 26.5,
28
- total_ability_scores_randomized: 26.5
27
+ roll_ability_scores_randomized: 30.5,
28
+ total_ability_scores_randomized: 30.5
29
29
  }.freeze
30
30
 
31
31
  def check_against_baseline!(baseline_value, test_value)
@@ -36,7 +36,7 @@ def check_against_baseline!(baseline_value, test_value)
36
36
  end
37
37
 
38
38
  puts "Set baseline"
39
- baselines = Benchmark.bmbm do |x|
39
+ baselines = Benchmark.bm do |x|
40
40
  # Random.rand()
41
41
  x.report("Random.rand") do # standard rand()
42
42
  n.times { Random.rand(1000) }
@@ -52,7 +52,7 @@ random_rand_baseline = baselines[0].real
52
52
  securerandom_baseline = baselines[1].real
53
53
 
54
54
  puts "Roll d1000s"
55
- total_dice_d1000_results = Benchmark.bmbm do |x|
55
+ total_dice_d1000_results = Benchmark.bm do |x|
56
56
  # NerdDice.total_dice securerandom
57
57
  x.report("total_dice_securerandom") do
58
58
  NerdDice.configuration.randomization_technique = :securerandom
@@ -84,7 +84,7 @@ check_against_baseline! random_rand_baseline, total_dice_random_object
84
84
  total_dice_randomized = total_dice_d1000_results[3]
85
85
  check_against_baseline! ((random_rand_baseline * 0.75) + (securerandom_baseline * 0.25)), total_dice_randomized
86
86
 
87
- roll_dice_d1000_results = Benchmark.bmbm do |x|
87
+ roll_dice_d1000_results = Benchmark.bm do |x|
88
88
  # NerdDice.roll_dice securerandom
89
89
  x.report("roll_dice_securerandom") do
90
90
  NerdDice.configuration.randomization_technique = :securerandom
@@ -117,7 +117,7 @@ roll_dice_randomized = roll_dice_d1000_results[3]
117
117
  check_against_baseline! ((random_rand_baseline * 0.75) + (securerandom_baseline * 0.25)), roll_dice_randomized
118
118
 
119
119
  puts "Roll 3d6"
120
- total_dice_3d6_results = Benchmark.bmbm do |x|
120
+ total_dice_3d6_results = Benchmark.bm do |x|
121
121
  # NerdDice.total_dice securerandom
122
122
  x.report("total_dice_securerandom_3d6") do
123
123
  NerdDice.configuration.randomization_technique = :securerandom
@@ -149,7 +149,7 @@ check_against_baseline! random_rand_baseline, total_dice_3d6_random_object
149
149
  total_dice_3d6_randomized = total_dice_3d6_results[3]
150
150
  check_against_baseline! ((random_rand_baseline * 0.75) + (securerandom_baseline * 0.25)), total_dice_3d6_randomized
151
151
 
152
- roll_dice_3d6_results = Benchmark.bmbm do |x|
152
+ roll_dice_3d6_results = Benchmark.bm do |x|
153
153
  # NerdDice.roll_dice securerandom
154
154
  x.report("roll_dice_securerandom_3d6") do
155
155
  NerdDice.configuration.randomization_technique = :securerandom
@@ -185,7 +185,7 @@ puts "Setting n down to 5,000 due to more intensive methods"
185
185
  n = 5_000
186
186
 
187
187
  puts "Roll and total ability scores"
188
- roll_ability_scores_results = Benchmark.bmbm do |x|
188
+ roll_ability_scores_results = Benchmark.bm do |x|
189
189
  x.report("roll_ability_scores_randomized") do
190
190
  NerdDice.configuration.randomization_technique = :randomized
191
191
  n.times { NerdDice.roll_ability_scores }
@@ -1,26 +1,27 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1zdGF0
3
- ZWxlc3Njb2RlL0RDPWdtYWlsL0RDPWNvbTAeFw0yMDEyMDYyMzQ1NTZaFw0yMTEy
4
- MDYyMzQ1NTZaMCgxJjAkBgNVBAMMHXN0YXRlbGVzc2NvZGUvREM9Z21haWwvREM9
5
- Y29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAyHIMJi0o3bwBZsx5
6
- TQ35XByFsdDRsro3T+0NY7EAILtOiU04o9C2NPOp/RQE7BXQgMjGebwp6bT6QvzN
7
- 6noV4jPL7Fi5pWw08QygG7f+73YUBb+8d8o+3xGrC+UO5h1PZEtVcZwUWUG18QBE
8
- fbDinQT6P4IDQoZwhfrPCB+aBfUyQp4Ok7oD7MEWqsq9SjrSxqxfk4+oZdXUySe7
9
- Vi5vnzVQ5uFf56NHwWnNKCzJzmH84mBO5MzHaQpHNzKGJPoUmzLU5RBlCH6YXqBG
10
- KhXTMUDBWKJmJ3RDry/FpGgJLKu4wzFRYjXla6IjeKozWGuPNNJ+2mesXKhsX7bo
11
- vVCzRxPEupbEg/0FkJiWpiGlSPOdd6oJiwX8E6rlEeV605xrbOQewkbovHkYTMtG
12
- +NH+u08x0z4Oj71kmDLwuj812uS0mtrCg2VhiYO0ZCQ4XrwBsBfK+/MtMlR+o6sG
13
- /zvz/vHVJKaLTQxRp5oGo4QH6HfbOnwzTkXdZnt5AlN31ErJAgMBAAGjgYEwfzAJ
14
- BgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUC7seYydsGO6O1qT4nVVD
15
-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l5aVpYdz/RTqdB92Mmud5Hj5zkuEE4CHBh8L8AJC5kZu/YUXXDtuECSMVhg5O84h
24
+ QsdcuygyVASmw2aliMAFXfIBDYelduG0XwjdOREN3q4SDTKP+pfBxx6OdD1RfsYF
25
+ /9HhtVbKLq34iQftF4oIH66bYDEyG5y4CLKQ8Nq0WDWq50OcaP9KpDiS21BC43SW
26
+ t+NX7PDOWx4k
26
27
  -----END CERTIFICATE-----
@@ -0,0 +1 @@
1
+ 30f9d3809362099e81e414bf987b711c8dad59703c68579809bb36ce9b199d58
@@ -0,0 +1 @@
1
+ 1a8913b8f2878c1471f32dadaddf9965fd61c7ef2e9a255961babdb9586f2c18b7eca1cd0f1021061fb69c96a330151a97df9a102b2871e1e1c5e5675f34a511
@@ -24,12 +24,17 @@ module NerdDice
24
24
  def harvest_totals(collection)
25
25
  collection.map(&:total)
26
26
  rescue NoMethodError => e
27
- specific_message =
28
- case e.message
27
+ specific_message = get_harvest_totals_error_message(e)
28
+ specific_message ? raise(ArgumentError, "You must provide a valid collection. #{specific_message}") : raise
29
+ end
30
+
31
+ private
32
+
33
+ def get_harvest_totals_error_message(rescued_error)
34
+ case rescued_error.message
29
35
  when /`total'/ then "Each element must respond to :total."
30
36
  when /`map'/ then "Argument must respond to :map."
31
37
  end
32
- specific_message ? raise(ArgumentError, "You must provide a valid collection. #{specific_message}") : raise
33
- end
38
+ end
34
39
  end
35
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NerdDice
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
data/nerd_dice.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.metadata["bug_tracker_uri"] = "https://github.com/statelesscode/nerd_dice/issues"
29
29
  spec.metadata["documentation_uri"] = "https://github.com/statelesscode/nerd_dice/README.md"
30
30
  spec.metadata["github_repo"] = "https://github.com/statelesscode/nerd_dice"
31
+ spec.metadata["rubygems_mfa_required"] = "true"
31
32
 
32
33
  # Specify which files should be added to the gem when it is released.
33
34
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -43,13 +44,13 @@ Gem::Specification.new do |spec|
43
44
  spec.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") if $PROGRAM_NAME.end_with?("gem")
44
45
 
45
46
  # Dependencies
46
- spec.add_dependency "securerandom", "~> 0.1", ">= 0.1.0"
47
+ spec.add_dependency "securerandom", "~> 0.2", ">= 0.2.2"
47
48
 
48
49
  # Development Dependencies
49
- spec.add_development_dependency "coveralls_reborn", "~> 0.22.0"
50
- spec.add_development_dependency "rubocop", "~> 1.20", ">= 1.20.0"
51
- spec.add_development_dependency "rubocop-performance", "~> 1.11", ">= 1.11.5"
50
+ spec.add_development_dependency "coveralls_reborn", "~> 0.27.0"
51
+ spec.add_development_dependency "rubocop", "~> 1.46", ">= 1.46.0"
52
+ spec.add_development_dependency "rubocop-performance", "~> 1.16", ">= 1.16.0"
52
53
  spec.add_development_dependency "rubocop-rake", "~> 0.6", ">= 0.6.0"
53
- spec.add_development_dependency "rubocop-rspec", "~> 2.4", ">= 2.4.0"
54
+ spec.add_development_dependency "rubocop-rspec", "~> 2.18", ">= 2.18.1"
54
55
  spec.add_development_dependency "simplecov-lcov", "~> 0.8.0"
55
56
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nerd_dice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Duchemin
@@ -10,32 +10,33 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1zdGF0
14
- ZWxlc3Njb2RlL0RDPWdtYWlsL0RDPWNvbTAeFw0yMDEyMDYyMzQ1N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H/1
23
+ 8tEPDoFYpJDOa5byX1j7srwO0B6WOtPxix7gW1wBbEp7eWSQf1k3k9XEh32SRsPq
24
+ NJObRfhkzoa9p1tPkVP3nasDTK5gtisolwhb7Vimeup54yKfT/THv2iNEnGTvK1P
25
+ sV4vC8nch88lBI1mIecmSh/mwED4Mb1dNtcyuB/+XnSI8vIzXJKAAKaT0eMCAwEA
26
+ AaOBgTB/MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBRP42hSa0JV
27
+ QGDSobiGTYyfM570hjAiBgNVHREEGzAZgRdzdGF0ZWxlc3Njb2RlQGdtYWlsLmNv
28
+ bTAiBgNVHRIEGzAZgRdzdGF0ZWxlc3Njb2RlQGdtYWlsLmNvbTANBgkqhkiG9w0B
29
+ AQsFAAOCAYEANtaR6OV7p1IJOsvVgGQzVg88NIOeXrfOaEDUPb6eg4JMOSL0Cvvl
30
+ 2F7lB/ykbQcO4Oe7NucuavC7ClyG3c/V5eQ5TtPNWkMbVN9ESVR8wk5SjhiI8L35
31
+ MBxJ6YU27eyDmazQJ7eCYcRJkuyWt3KcqgsEh7JyNnKcJ/3rgf1QW0IyJiGsXM1I
32
+ SssQ/t7Ia2tVMrVMsvs834v9FRpVbO3dHdCO4t7zQBIADVcj4NqCDV10D6aji/Aa
33
+ 35YJHwlkhuZH6AYC45QHt9dW0/OLmbFwoJqW7syrso2PParyMr4YcJwucXViRiL7
34
+ l5aVpYdz/RTqdB92Mmud5Hj5zkuEE4CHBh8L8AJC5kZu/YUXXDtuECSMVhg5O84h
35
+ QsdcuygyVASmw2aliMAFXfIBDYelduG0XwjdOREN3q4SDTKP+pfBxx6OdD1RfsYF
36
+ /9HhtVbKLq34iQftF4oIH66bYDEyG5y4CLKQ8Nq0WDWq50OcaP9KpDiS21BC43SW
37
+ t+NX7PDOWx4k
37
38
  -----END CERTIFICATE-----
38
- date: 2021-09-11 00:00:00.000000000 Z
39
+ date: 2023-02-24 00:00:00.000000000 Z
39
40
  dependencies:
40
41
  - !ruby/object:Gem::Dependency
41
42
  name: securerandom
@@ -43,74 +44,74 @@ dependencies:
43
44
  requirements:
44
45
  - - "~>"
45
46
  - !ruby/object:Gem::Version
46
- version: '0.1'
47
+ version: '0.2'
47
48
  - - ">="
48
49
  - !ruby/object:Gem::Version
49
- version: 0.1.0
50
+ version: 0.2.2
50
51
  type: :runtime
51
52
  prerelease: false
52
53
  version_requirements: !ruby/object:Gem::Requirement
53
54
  requirements:
54
55
  - - "~>"
55
56
  - !ruby/object:Gem::Version
56
- version: '0.1'
57
+ version: '0.2'
57
58
  - - ">="
58
59
  - !ruby/object:Gem::Version
59
- version: 0.1.0
60
+ version: 0.2.2
60
61
  - !ruby/object:Gem::Dependency
61
62
  name: coveralls_reborn
62
63
  requirement: !ruby/object:Gem::Requirement
63
64
  requirements:
64
65
  - - "~>"
65
66
  - !ruby/object:Gem::Version
66
- version: 0.22.0
67
+ version: 0.27.0
67
68
  type: :development
68
69
  prerelease: false
69
70
  version_requirements: !ruby/object:Gem::Requirement
70
71
  requirements:
71
72
  - - "~>"
72
73
  - !ruby/object:Gem::Version
73
- version: 0.22.0
74
+ version: 0.27.0
74
75
  - !ruby/object:Gem::Dependency
75
76
  name: rubocop
76
77
  requirement: !ruby/object:Gem::Requirement
77
78
  requirements:
78
79
  - - "~>"
79
80
  - !ruby/object:Gem::Version
80
- version: '1.20'
81
+ version: '1.46'
81
82
  - - ">="
82
83
  - !ruby/object:Gem::Version
83
- version: 1.20.0
84
+ version: 1.46.0
84
85
  type: :development
85
86
  prerelease: false
86
87
  version_requirements: !ruby/object:Gem::Requirement
87
88
  requirements:
88
89
  - - "~>"
89
90
  - !ruby/object:Gem::Version
90
- version: '1.20'
91
+ version: '1.46'
91
92
  - - ">="
92
93
  - !ruby/object:Gem::Version
93
- version: 1.20.0
94
+ version: 1.46.0
94
95
  - !ruby/object:Gem::Dependency
95
96
  name: rubocop-performance
96
97
  requirement: !ruby/object:Gem::Requirement
97
98
  requirements:
98
99
  - - "~>"
99
100
  - !ruby/object:Gem::Version
100
- version: '1.11'
101
+ version: '1.16'
101
102
  - - ">="
102
103
  - !ruby/object:Gem::Version
103
- version: 1.11.5
104
+ version: 1.16.0
104
105
  type: :development
105
106
  prerelease: false
106
107
  version_requirements: !ruby/object:Gem::Requirement
107
108
  requirements:
108
109
  - - "~>"
109
110
  - !ruby/object:Gem::Version
110
- version: '1.11'
111
+ version: '1.16'
111
112
  - - ">="
112
113
  - !ruby/object:Gem::Version
113
- version: 1.11.5
114
+ version: 1.16.0
114
115
  - !ruby/object:Gem::Dependency
115
116
  name: rubocop-rake
116
117
  requirement: !ruby/object:Gem::Requirement
@@ -137,20 +138,20 @@ dependencies:
137
138
  requirements:
138
139
  - - "~>"
139
140
  - !ruby/object:Gem::Version
140
- version: '2.4'
141
+ version: '2.18'
141
142
  - - ">="
142
143
  - !ruby/object:Gem::Version
143
- version: 2.4.0
144
+ version: 2.18.1
144
145
  type: :development
145
146
  prerelease: false
146
147
  version_requirements: !ruby/object:Gem::Requirement
147
148
  requirements:
148
149
  - - "~>"
149
150
  - !ruby/object:Gem::Version
150
- version: '2.4'
151
+ version: '2.18'
151
152
  - - ">="
152
153
  - !ruby/object:Gem::Version
153
- version: 2.4.0
154
+ version: 2.18.1
154
155
  - !ruby/object:Gem::Dependency
155
156
  name: simplecov-lcov
156
157
  requirement: !ruby/object:Gem::Requirement
@@ -204,6 +205,8 @@ files:
204
205
  - checksum/nerd_dice-0.1.1.gem.sha512
205
206
  - checksum/nerd_dice-0.2.0.gem.sha256
206
207
  - checksum/nerd_dice-0.2.0.gem.sha512
208
+ - checksum/nerd_dice-0.3.0.gem.sha256
209
+ - checksum/nerd_dice-0.3.0.gem.sha512
207
210
  - lib/nerd_dice.rb
208
211
  - lib/nerd_dice/class_methods.rb
209
212
  - lib/nerd_dice/class_methods/configure.rb
@@ -232,6 +235,7 @@ metadata:
232
235
  bug_tracker_uri: https://github.com/statelesscode/nerd_dice/issues
233
236
  documentation_uri: https://github.com/statelesscode/nerd_dice/README.md
234
237
  github_repo: https://github.com/statelesscode/nerd_dice
238
+ rubygems_mfa_required: 'true'
235
239
  post_install_message:
236
240
  rdoc_options: []
237
241
  require_paths:
@@ -247,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
251
  - !ruby/object:Gem::Version
248
252
  version: '0'
249
253
  requirements: []
250
- rubygems_version: 3.2.22
254
+ rubygems_version: 3.4.7
251
255
  signing_key:
252
256
  specification_version: 4
253
257
  summary: A Ruby Gem for rolling polyhedral dice.
metadata.gz.sig CHANGED
@@ -1,3 +1,5 @@
1
- C����w
2
- �g4���]T۞~����s�����ul�!��o��D���#����`t��r��r̋8l��������M]Tu���M���X�Ʌe/���ϧ9��.�>�G��B��'��R��� �۽/r"wa�����P��p�0���pd޼�v�,�N�_㼨�����krd��PT������͋)V�c�"#RG�З{��|�nP 9�X�s�p�i���>�?^�6LXQ�.4 �O�ء6怳�`ݣ�D.����ڠ|�S��:a�P��j���"��1ȩF�*V7��
3
- �-�wr���[ 57��,�4���_��}SJ:
1
+ Q�<Ezx�Q���k2������(U_�����
2
+ ��H[�s����{psn�/ηA{^'"A�뷻���VzXA��BF!8���c���^^w��7��n�=:���
3
+ V��7GZ-�Ni���Ǜ��������o�Vz��S��:�$�qu��K �#/�fz��6;�Z�;yaMN�vl��W�,9t�
4
+ ���\��B�󤰿V�^����V('�Oaa��bݘN��qOŷ!�_��Z�k���<�n_>~*�:K/����
5
+ �uF