rdc_lotto 0.0.1 → 0.0.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 +4 -4
- data/lib/rdc_lotto/configuration.rb +10 -0
- data/lib/rdc_lotto/drawing.rb +19 -0
- data/lib/rdc_lotto/version.rb +1 -1
- data/lib/rdc_lotto.rb +11 -9
- data/spec/rdc_lotto/configuration_spec.rb +19 -0
- data/spec/rdc_lotto/drawing_spec.rb +2 -2
- data/spec/rdc_lotto_spec.rb +17 -0
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 467ef64c339f275ef9eacd30d99b5c1d885430e7
|
|
4
|
+
data.tar.gz: 308a20ad0873accd63799af4f866c03e64244ae9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a064b756bd09c4cdc3d059a07ab70ff75678dd47ccf995afecc6fe3906a63d3734434af914daf1f0f2eca8999b4cc6ea8412b3733abf4a54452f78b7fd660286
|
|
7
|
+
data.tar.gz: 84c479b54717038c21331a983cfa369fdd82743d6175b78f4c5d4bdbe12e5d649152a6eb63e6d8790a3c9d33f5102327479dd2ba9b332ff3d342b755b78bf66c
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module RdcLotto
|
|
2
|
+
class Drawing
|
|
3
|
+
attr_accessor :config
|
|
4
|
+
|
|
5
|
+
def initialize(config = Configuration.new)
|
|
6
|
+
@config = config
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def draw
|
|
10
|
+
@config.drawing_count.times.map { draw_number }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def draw_number
|
|
16
|
+
rand(0..59)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/rdc_lotto/version.rb
CHANGED
data/lib/rdc_lotto.rb
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
require "rdc_lotto/version"
|
|
2
|
+
require "rdc_lotto/configuration"
|
|
3
|
+
require "rdc_lotto/drawing"
|
|
2
4
|
|
|
3
5
|
module RdcLotto
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
end
|
|
6
|
+
class << self
|
|
7
|
+
attr_writer :configuration
|
|
8
|
+
end
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
def self.configuration
|
|
11
|
+
@configuration ||= Configuration.new
|
|
12
|
+
end
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
14
|
+
def self.configure
|
|
15
|
+
yield(configuration)
|
|
16
|
+
end
|
|
15
17
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module RdcLotto
|
|
4
|
+
describe Configuration do
|
|
5
|
+
describe "#drawing_count" do
|
|
6
|
+
it "default value is 6" do
|
|
7
|
+
RdcLotto::Configuration.new.drawing_count = 10
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe "#drawing_count=" do
|
|
12
|
+
it "can set value" do
|
|
13
|
+
config = RdcLotto::Configuration.new
|
|
14
|
+
config.drawing_count = 10
|
|
15
|
+
expect(config.drawing_count).to eq(10)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe RdcLotto do
|
|
4
|
+
describe "#configure" do
|
|
5
|
+
before :each do
|
|
6
|
+
RdcLotto.configure do |config|
|
|
7
|
+
config.drawing_count = 10
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "returns an array with 10 elements" do
|
|
12
|
+
draw = RdcLotto::Drawing.new.draw
|
|
13
|
+
expect(draw).to be_a(Array)
|
|
14
|
+
expect(draw.size).to eq(10)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rdc_lotto
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roberto Del Castillo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-04-
|
|
11
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -66,9 +66,13 @@ files:
|
|
|
66
66
|
- README.md
|
|
67
67
|
- Rakefile
|
|
68
68
|
- lib/rdc_lotto.rb
|
|
69
|
+
- lib/rdc_lotto/configuration.rb
|
|
70
|
+
- lib/rdc_lotto/drawing.rb
|
|
69
71
|
- lib/rdc_lotto/version.rb
|
|
70
72
|
- rdc_lotto.gemspec
|
|
73
|
+
- spec/rdc_lotto/configuration_spec.rb
|
|
71
74
|
- spec/rdc_lotto/drawing_spec.rb
|
|
75
|
+
- spec/rdc_lotto_spec.rb
|
|
72
76
|
- spec/spec_helper.rb
|
|
73
77
|
homepage: https://rubygems.org/gems/rdc_lotto
|
|
74
78
|
licenses:
|
|
@@ -95,5 +99,7 @@ signing_key:
|
|
|
95
99
|
specification_version: 4
|
|
96
100
|
summary: A lotto gem
|
|
97
101
|
test_files:
|
|
102
|
+
- spec/rdc_lotto/configuration_spec.rb
|
|
98
103
|
- spec/rdc_lotto/drawing_spec.rb
|
|
104
|
+
- spec/rdc_lotto_spec.rb
|
|
99
105
|
- spec/spec_helper.rb
|