first_test 0.1.0 → 0.2.0
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/README.md +10 -1
- data/first_test.gemspec +1 -0
- data/lib/first_test.rb +16 -0
- data/lib/first_test/drawing.rb +15 -1
- data/lib/first_test/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c8fe7496810cca33b5a9cbe7af83d5aa44ef45e
|
4
|
+
data.tar.gz: be346a9327c2ec8238d22835ff37041a48102f18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df535e95f79e05090477a8bface07ba7d71292cf2edefedb9cad98ecd73fb0f7578ca2bb61a0dee33b7608b001f2b5db9b98bc0ed2aae4202b0aaaa6d80fe98c
|
7
|
+
data.tar.gz: 62b116994a74dd16026adccaf513ff488c581896ee750c254e4ffbb23011409c8a912de6425a827eff49d3ff4300142b87f7f46c911870e3b6a17271be27aa2e
|
data/README.md
CHANGED
@@ -22,7 +22,16 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
随机生成6个60以下的随机数组成的数组
|
26
|
+
```ruby
|
27
|
+
FirstTest::Drawing.new.draw
|
28
|
+
```
|
29
|
+
控制生成数组的个数
|
30
|
+
```ruby
|
31
|
+
FirstTest.configure do |config|
|
32
|
+
config.drawing_count = 10
|
33
|
+
end
|
34
|
+
```
|
26
35
|
|
27
36
|
## Development
|
28
37
|
|
data/first_test.gemspec
CHANGED
data/lib/first_test.rb
CHANGED
@@ -2,9 +2,25 @@ require "first_test/version"
|
|
2
2
|
require "first_test/drawing"
|
3
3
|
begin
|
4
4
|
require "pry"
|
5
|
+
require "byebug"
|
5
6
|
rescue LoadError
|
6
7
|
|
7
8
|
end
|
8
9
|
module FirstTest
|
9
10
|
# Your code goes here...
|
11
|
+
class << self
|
12
|
+
attr_accessor :configuration
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configuration
|
16
|
+
@configuration ||= Configuration.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.reset
|
20
|
+
@configuration = Configuration.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.configure
|
24
|
+
yield(configuration)
|
25
|
+
end
|
10
26
|
end
|
data/lib/first_test/drawing.rb
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
module FirstTest
|
2
2
|
class Drawing
|
3
|
+
|
4
|
+
attr_accessor :config
|
5
|
+
|
6
|
+
def initialize(config = Configuration.new)
|
7
|
+
@config = config
|
8
|
+
end
|
9
|
+
|
3
10
|
def draw
|
4
|
-
|
11
|
+
config.drawing_count.times.map { single_draw }
|
5
12
|
end
|
6
13
|
private
|
7
14
|
def single_draw
|
8
15
|
rand(0...60)
|
9
16
|
end
|
10
17
|
end
|
18
|
+
|
19
|
+
class Configuration
|
20
|
+
attr_accessor :drawing_count
|
21
|
+
def initialize
|
22
|
+
@drawing_count = 6
|
23
|
+
end
|
24
|
+
end
|
11
25
|
end
|
data/lib/first_test/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: first_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- li-yun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: range create array
|
70
84
|
email:
|
71
85
|
- li-yun....
|