first_gem_mega_lotto 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed40a5a94df303ed4cb94602d7078749670dfe160a2a8065d54fc56e08734a1e
4
- data.tar.gz: 5218d6edb31530004e46c8daf07c7f0fa6406c503aea789166bdd536dca9b659
3
+ metadata.gz: 4dda1c53371a8c64d9c3ed868d2fd5719f6c524dd1c25b10730d6955f70aa3d2
4
+ data.tar.gz: 59c6ca44c56a2f7f632c0374a364cb220e980376e79ad400f1cdc319263b1aa7
5
5
  SHA512:
6
- metadata.gz: 7037b97b073482d4adceef90ff83596065fcd42c71860a516bbf87be60b196113d221e64123dd4666fc24be2484b8c5521685681333a328b2870ab7b8ca8419c
7
- data.tar.gz: 56c791a0a72e7a853db33e9e58c258b02155bfa4e9b29a8e6c1554e65dacb0f3d121d85a18e5c6be227a0b9829fb027bba9d69d87f54050b90c0c07f1838801f
6
+ metadata.gz: f5cd9edfec24297626532dfec25e6cffed440b11b0316b6a52deb983468774efdb8d20ec57decd57e8270f960389454c0575790fe8c52875be98d4d49c5a7f81
7
+ data.tar.gz: 8f4c49e0803d4dbff40e9a1ae03d00427d29543e01e837fe52196ca2f11415bdfe26133c184a64dfd59bfe8536b2a2fca0197566598ea99b06e22028cc45770f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- first_gem_mega_lotto (0.2.1)
4
+ first_gem_mega_lotto (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MegaLotto
4
+ class Configuration
5
+ attr_writer :drawing_count
6
+
7
+ def drawing_count
8
+ @drawing_count ||= 6
9
+ end
10
+ end
11
+ end
@@ -3,8 +3,10 @@
3
3
  module MegaLotto
4
4
  # Drawing business logic
5
5
  class Drawing
6
+ attr_accessor :drawing_count
7
+
6
8
  def draw
7
- Array.new(6) { single_random_draw }
9
+ Array.new(MegaLotto.configuration.drawing_count) { single_random_draw }
8
10
  end
9
11
 
10
12
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MegaLotto
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
data/lib/mega_lotto.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'mega_lotto/version'
4
+ require 'mega_lotto/configuration'
4
5
 
5
6
  begin
6
7
  require 'pry-byebug'
@@ -9,4 +10,15 @@ end
9
10
 
10
11
  module MegaLotto
11
12
  class Error < StandardError; end
13
+ class << self
14
+ attr_writer :configuration
15
+ end
16
+
17
+ def self.configuration
18
+ @configuration ||= Configuration.new
19
+ end
20
+
21
+ def self.configure
22
+ yield(configuration)
23
+ end
12
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: first_gem_mega_lotto
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
  - Tien Do
@@ -129,6 +129,7 @@ files:
129
129
  - bin/setup
130
130
  - exe/mega_lotto
131
131
  - lib/mega_lotto.rb
132
+ - lib/mega_lotto/configuration.rb
132
133
  - lib/mega_lotto/drawing.rb
133
134
  - lib/mega_lotto/version.rb
134
135
  - mega_lotto.gemspec