first_gem_mega_lotto 0.1.0 → 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: 639a00d6259f49f8b1cbc5cd7746b280119fb51cb3da9ee0aa84f68830e8178b
4
- data.tar.gz: 3066a81f1fca1c715973e93258124431389862db88cc46d7da2f31a3e00ee479
3
+ metadata.gz: 4dda1c53371a8c64d9c3ed868d2fd5719f6c524dd1c25b10730d6955f70aa3d2
4
+ data.tar.gz: 59c6ca44c56a2f7f632c0374a364cb220e980376e79ad400f1cdc319263b1aa7
5
5
  SHA512:
6
- metadata.gz: a08072dd49664ace956295ee0cf9963fd642c90bbeaaf54b4f6f286dc359a22543c886016a5715156ffaf9cc4a694fdca2a9869dea6045be03d1e257bffa3d3c
7
- data.tar.gz: ac1c8e70f327d0e81cbbf19e5fbdcc85a9832831f8c9428ed0639b05a6327677b881b749e09ad2710781988ee600c06c2c0d124adc4b04b9ae22d533aac0cee1
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.1.0)
4
+ first_gem_mega_lotto (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/exe/mega_lotto ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require_relative '../lib/mega_lotto/drawing'
4
+
5
+ drawing=MegaLotto::Drawing.new.draw
6
+ puts drawing
@@ -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
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MegaLotto
4
+ # Drawing business logic
4
5
  class Drawing
6
+ attr_accessor :drawing_count
7
+
5
8
  def draw
6
- Array.new(5) { single_random_draw }
9
+ Array.new(MegaLotto.configuration.drawing_count) { single_random_draw }
7
10
  end
8
11
 
9
12
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MegaLotto
4
- VERSION = '0.1.0'
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
data/mega_lotto.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  end
25
25
  spec.bindir = "exe"
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.executables << 'mega_lotto'
27
28
  spec.require_paths = ["lib"]
28
29
  spec.add_development_dependency "rspec"
29
30
  spec.add_development_dependency "pry-byebug"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: first_gem_mega_lotto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tien Do
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-21 00:00:00.000000000 Z
11
+ date: 2022-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -111,7 +111,8 @@ dependencies:
111
111
  description: Experiment with my first gem
112
112
  email:
113
113
  - forever.love.wisdom@gmail.com
114
- executables: []
114
+ executables:
115
+ - mega_lotto
115
116
  extensions: []
116
117
  extra_rdoc_files: []
117
118
  files:
@@ -126,7 +127,9 @@ files:
126
127
  - Rakefile
127
128
  - bin/console
128
129
  - bin/setup
130
+ - exe/mega_lotto
129
131
  - lib/mega_lotto.rb
132
+ - lib/mega_lotto/configuration.rb
130
133
  - lib/mega_lotto/drawing.rb
131
134
  - lib/mega_lotto/version.rb
132
135
  - mega_lotto.gemspec