arkaan 1.2.10 → 1.2.11

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: b50f576a1b8c4a3c6a23194c4051d2f8bb9f55c8
4
- data.tar.gz: 29d138e61520cd6bb7f2e92118d3a07685feaf70
3
+ metadata.gz: 82aa68bb4f6bce232d42d45f87f6c14c0e07440c
4
+ data.tar.gz: bb2a4b384892b5e13b79ff0cd9e381ce5adf9c5f
5
5
  SHA512:
6
- metadata.gz: 1df51808e2ec4c7653c3e225e7ba5d3c585d07b59697d9cb84bd075ab823cac01179d474667d44d78c5f03b2b841a4aea01dbc05b4fdbf042d822e73105eeda5
7
- data.tar.gz: dda67b64617e4a7e3ddc94be58884090338ee1fef4f3b388fb9e1684120b2f21129333428037bbaa5a2547bf678ca8aa2a0f1fb4d9e1c6d21f122fe9dc7a857f
6
+ metadata.gz: ecdcac9b934815ea41f52afc3be2c6fb600fde45b69cf9eeb10e16994512d1a130d8c3ca48820f2b8c921f7786aca122cc717c91add76837c0507efda85f9938
7
+ data.tar.gz: 906e1b8c58df10283f679f1f4933948da640a4e00db46f95459b60e557f200d8a0efdec0252cda2c2dc349d72b10ae3087cb833b72532b34187f33b01eea648b
@@ -15,6 +15,18 @@ module Arkaan
15
15
  # @!attribute [rw] modifier
16
16
  # @return [Integer] the value added to the sum of all dices to get the final result.
17
17
  field :modifier, type: Integer, default: 0
18
+ # @!attribute [rw] results
19
+ # @return [Array<Integer>] an array of integers, each one of them representing the result for one of the dices.
20
+ field :results, type: Array, default: []
21
+
22
+ # Computes the results before saving the document, the first time it's saved.
23
+ before_save do |document|
24
+ if !document.persisted?
25
+ number_of_dices.times do
26
+ results << rand(document.number_of_faces) + 1
27
+ end
28
+ end
29
+ end
18
30
  end
19
31
  end
20
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkaan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.10
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois