xiaodao_mega_lotto 0.1.0 → 0.2.0

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: ca352c5266e27abf27dc438d1e380b85b13abb9b
4
- data.tar.gz: a52fe4c1adfed5db737693e8222aa9977c5ab654
3
+ metadata.gz: 20548d192952412eee588c5152efde9faea24d07
4
+ data.tar.gz: 9e9d1b87fbd9f82738e90b12971cbfaa7753ac01
5
5
  SHA512:
6
- metadata.gz: 07308c25e638bae394fc26f7fdab13ed06d6a92b618a7743f65acc5811409aeabb36997d0579b9c828dc58c871ec1d4c07484d1214c20edc0383bb33fb17efd4
7
- data.tar.gz: 8d4092f1c9de6077beab3478748b47ae6026fa0635549102a07104a3b51d6415e2806f9e1b858aaaebe622173f02d1fdb65f138d0f4a21be9eb879213bdbe4aa
6
+ metadata.gz: 79745a959d1e0fb50d321bd039a749d9adc9222c85a0b61c7196aec2870adc248eb846a36cb494b909d6da017eeb11b82b7e12b1e1579eb28822c58204873f44
7
+ data.tar.gz: 3bde553cf7808693db9969480111aa4cb90212243f52efa82f71aa7cf222aba4d8979850b88f464b1c6e59b3c281b35a3e873c376c0ea5afc4c84939956e13fb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xiaodao_mega_lotto (0.1.0)
4
+ xiaodao_mega_lotto (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/xiaodao_mega_lotto/drawing"
4
+ require_relative "../lib/xiaodao_mega_lotto/configuration"
5
+ drawing = XiaodaoMegaLotto::Drawing.new.draw
6
+ puts drawing
@@ -0,0 +1,9 @@
1
+ module XiaodaoMegaLotto
2
+ class Configuration
3
+ attr_accessor :drawing_count
4
+
5
+ def initialize
6
+ @drawing_count = 6
7
+ end
8
+ end
9
+ end
@@ -1,11 +1,18 @@
1
1
  module XiaodaoMegaLotto
2
2
  class Drawing
3
+ attr_accessor :config
4
+
5
+ def initialize(config = Configuration.new)
6
+ @config = config
7
+ end
8
+
3
9
  def draw
4
- 5.times.map { single_draw }
10
+ @config.drawing_count.times.map { single_draw }
5
11
  end
12
+
6
13
  private
7
14
  def single_draw
8
- rand(0...60)
15
+ rand(0...60)
9
16
  end
10
17
  end
11
18
  end
@@ -1,3 +1,3 @@
1
1
  module XiaodaoMegaLotto
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "xiaodao_mega_lotto/version"
2
+ require "xiaodao_mega_lotto/configuration"
2
3
  require "xiaodao_mega_lotto/drawing"
3
4
  begin
4
5
  require "pry"
@@ -6,4 +7,19 @@ rescue LoadError
6
7
  end
7
8
 
8
9
  module XiaodaoMegaLotto
10
+ class << self
11
+ attr_accessor :configuration
12
+ end
13
+
14
+ def self.configuration
15
+ @configuration ||= Configuration.new
16
+ end
17
+
18
+ def self.reset
19
+ @configuration = Configuration.new
20
+ end
21
+
22
+ def self.configure
23
+ yield(configuration)
24
+ end
9
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xiaodao_mega_lotto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - liupc-ubuntu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-10 00:00:00.000000000 Z
11
+ date: 2019-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,9 @@ files:
83
83
  - Rakefile
84
84
  - bin/console
85
85
  - bin/setup
86
+ - bin/xiaodao_mega_lotto
86
87
  - lib/xiaodao_mega_lotto.rb
88
+ - lib/xiaodao_mega_lotto/configuration.rb
87
89
  - lib/xiaodao_mega_lotto/drawing.rb
88
90
  - lib/xiaodao_mega_lotto/version.rb
89
91
  - xiaodao_mega_lotto.gemspec