sixarm_ruby_fab 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -1
- data.tar.gz.sig +0 -0
- data/README.md +2 -1
- data/lib/sixarm_ruby_fab/date.rb +21 -1
- data/lib/sixarm_ruby_fab/datetime.rb +22 -2
- data/lib/sixarm_ruby_fab/time.rb +23 -3
- data/test/sixarm_ruby_fab_test/date_test.rb +50 -0
- data/test/sixarm_ruby_fab_test/datetime_test.rb +50 -0
- data/test/sixarm_ruby_fab_test/time_test.rb +50 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 928df2312ff8a41a06835e0cd4f85d2e54144abb
|
4
|
+
data.tar.gz: 72519949a884dd6a82e7b06c1a79edca256644cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eeae5c0abd20644e0e67c29fa5880e57aed4326ef61f32ada4eb23e4d45dc04d7d3261560ff1bedcd1a2cafc1b530c3a47ef70794134feb17d7af27b94bf400
|
7
|
+
data.tar.gz: ab221a63c2879ffd4d500e6af4c10c528378f3ebddc7ea983323b1219bb5a77344fb6772200ae7e13547f1755be475af8269a357f9ac2cb9b56154462728461d
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
��p�:YN��YlBҕG�kp�S�uzp$W8���ᇄzc���+�ti�8���Hr�1C��Ť�)Se`��p9I�Ӕ���V�r�m��SqD�B5����8k&q��W7�j&��u�^��LI�D�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Install:
|
|
24
24
|
|
25
25
|
Bundler:
|
26
26
|
|
27
|
-
gem "sixarm_ruby_fab", "~>1.0.0"
|
27
|
+
gem "sixarm_ruby_fab", "~>1.0.0"
|
28
28
|
|
29
29
|
Require:
|
30
30
|
|
@@ -59,6 +59,7 @@ Use it:
|
|
59
59
|
|
60
60
|
## Changes
|
61
61
|
|
62
|
+
* 2013-08-02 1.0.1 Add min & max to date, datetime, time.
|
62
63
|
* 2013-08-01 1.0.0 Publish.
|
63
64
|
|
64
65
|
|
data/lib/sixarm_ruby_fab/date.rb
CHANGED
@@ -10,9 +10,29 @@ class Fab
|
|
10
10
|
# @returns [Date] a random date min..max
|
11
11
|
#
|
12
12
|
def date(options = {})
|
13
|
-
rand((options[:min] ||
|
13
|
+
rand((options[:min] || date_min)..(options[:max] || date_max))
|
14
14
|
end
|
15
15
|
|
16
|
+
# Get. The default is today - 1000.
|
17
|
+
def date_min
|
18
|
+
@date_min ||= Date.today - 1000
|
19
|
+
end
|
20
|
+
|
21
|
+
# Set.
|
22
|
+
def date_min=x
|
23
|
+
@date_min=x
|
24
|
+
end
|
25
|
+
|
26
|
+
# Get. The default is today + 1000.
|
27
|
+
def date_max
|
28
|
+
@date_max ||= Date.today + 1000
|
29
|
+
end
|
30
|
+
|
31
|
+
# Set.
|
32
|
+
def date_max=x
|
33
|
+
@date_max=x
|
34
|
+
end
|
35
|
+
|
16
36
|
# Fab a random start date.
|
17
37
|
# Delegates to #date.
|
18
38
|
#
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Fab
|
2
|
-
|
2
|
+
|
3
3
|
# Fab a random datetime.
|
4
4
|
#
|
5
5
|
# Options:
|
@@ -10,9 +10,29 @@ class Fab
|
|
10
10
|
# @returns [DateTime] a random datetime min..max
|
11
11
|
#
|
12
12
|
def datetime(options = {})
|
13
|
-
rand((options[:min] ||
|
13
|
+
rand((options[:min] || datetime_min)..(options[:max] || datetime_max))
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get. The default is now - 1000.
|
17
|
+
def datetime_min
|
18
|
+
@datetime_min ||= DateTime.now - 1000
|
19
|
+
end
|
20
|
+
|
21
|
+
# Set.
|
22
|
+
def datetime_min=x
|
23
|
+
@datetime_min=x
|
14
24
|
end
|
15
25
|
|
26
|
+
# Get. The default is now + 1000.
|
27
|
+
def datetime_max
|
28
|
+
@datetime_max ||= DateTime.now + 1000
|
29
|
+
end
|
30
|
+
|
31
|
+
# Set.
|
32
|
+
def datetime_max=x
|
33
|
+
@datetime_max=x
|
34
|
+
end
|
35
|
+
|
16
36
|
# Fab a random start datetime.
|
17
37
|
# Delegates to #datetime.
|
18
38
|
#
|
data/lib/sixarm_ruby_fab/time.rb
CHANGED
@@ -4,13 +4,33 @@ class Fab
|
|
4
4
|
#
|
5
5
|
# Options:
|
6
6
|
#
|
7
|
-
# * min
|
8
|
-
# * max
|
7
|
+
# * min
|
8
|
+
# * max
|
9
9
|
#
|
10
10
|
# @returns [Time] a random time min..max
|
11
11
|
#
|
12
12
|
def time(options = {})
|
13
|
-
rand((options[:min] ||
|
13
|
+
rand((options[:min] || time_min)..(options[:max] || time_max))
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get. The default is now - 1000.
|
17
|
+
def time_min
|
18
|
+
@time_min ||= Time.now - 1000
|
19
|
+
end
|
20
|
+
|
21
|
+
# Set.
|
22
|
+
def time_min=x
|
23
|
+
@time_min=x
|
24
|
+
end
|
25
|
+
|
26
|
+
# Get. The default is now + 1000.
|
27
|
+
def time_max
|
28
|
+
@time_max ||= Time.now + 1000
|
29
|
+
end
|
30
|
+
|
31
|
+
# Set.
|
32
|
+
def time_max=x
|
33
|
+
@time_max=x
|
14
34
|
end
|
15
35
|
|
16
36
|
# Fab a random start time.
|
@@ -19,6 +19,56 @@ describe Fab do
|
|
19
19
|
|
20
20
|
end
|
21
21
|
|
22
|
+
describe "#date_min" do
|
23
|
+
|
24
|
+
before do
|
25
|
+
@x = fab.date_min
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns a date" do
|
29
|
+
@x.must_be_kind_of Date
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#date_min=" do
|
35
|
+
|
36
|
+
before do
|
37
|
+
@x = Date.today
|
38
|
+
end
|
39
|
+
|
40
|
+
it "sets & gets" do
|
41
|
+
fab.date_min = @x
|
42
|
+
fab.date_min.must_equal @x
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#date_max" do
|
48
|
+
|
49
|
+
before do
|
50
|
+
@x = fab.date_max
|
51
|
+
end
|
52
|
+
|
53
|
+
it "returns a date" do
|
54
|
+
@x.must_be_kind_of Date
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#date_max=" do
|
60
|
+
|
61
|
+
before do
|
62
|
+
@x = Date.today
|
63
|
+
end
|
64
|
+
|
65
|
+
it "sets & gets" do
|
66
|
+
fab.date_max = @x
|
67
|
+
fab.date_max.must_equal @x
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
22
72
|
describe "#start_date" do
|
23
73
|
|
24
74
|
before do
|
@@ -18,6 +18,56 @@ describe Fab do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
describe "#datetime_min" do
|
22
|
+
|
23
|
+
before do
|
24
|
+
@x = fab.datetime_min
|
25
|
+
end
|
26
|
+
|
27
|
+
it "returns a datetime" do
|
28
|
+
@x.must_be_kind_of DateTime
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#datetime_min=" do
|
34
|
+
|
35
|
+
before do
|
36
|
+
@x = DateTime.now
|
37
|
+
end
|
38
|
+
|
39
|
+
it "sets & gets" do
|
40
|
+
fab.datetime_min = @x
|
41
|
+
fab.datetime_min.must_equal @x
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#datetime_max" do
|
47
|
+
|
48
|
+
before do
|
49
|
+
@x = fab.datetime_max
|
50
|
+
end
|
51
|
+
|
52
|
+
it "returns a datetime" do
|
53
|
+
@x.must_be_kind_of DateTime
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#datetime_max=" do
|
59
|
+
|
60
|
+
before do
|
61
|
+
@x = DateTime.now
|
62
|
+
end
|
63
|
+
|
64
|
+
it "sets & gets" do
|
65
|
+
fab.datetime_max = @x
|
66
|
+
fab.datetime_max.must_equal @x
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
21
71
|
describe "#start_datetime" do
|
22
72
|
|
23
73
|
before do
|
@@ -19,6 +19,56 @@ describe Fab do
|
|
19
19
|
|
20
20
|
end
|
21
21
|
|
22
|
+
describe "#time_min" do
|
23
|
+
|
24
|
+
before do
|
25
|
+
@x = fab.time_min
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns a time" do
|
29
|
+
@x.must_be_kind_of Time
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#time_min=" do
|
35
|
+
|
36
|
+
before do
|
37
|
+
@x = Time.now
|
38
|
+
end
|
39
|
+
|
40
|
+
it "sets & gets" do
|
41
|
+
fab.time_min = @x
|
42
|
+
fab.time_min.must_equal @x
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#time_max" do
|
48
|
+
|
49
|
+
before do
|
50
|
+
@x = fab.time_max
|
51
|
+
end
|
52
|
+
|
53
|
+
it "returns a time" do
|
54
|
+
@x.must_be_kind_of Time
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#time_max=" do
|
60
|
+
|
61
|
+
before do
|
62
|
+
@x = Time.now
|
63
|
+
end
|
64
|
+
|
65
|
+
it "sets & gets" do
|
66
|
+
fab.time_max = @x
|
67
|
+
fab.time_max.must_equal @x
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
22
72
|
describe "#start_time" do
|
23
73
|
|
24
74
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sixarm_ruby_fab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SixArm
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
ZDRQYMqru9TEMna6HD9zpcstF7vwThGovlOQ+3Y6plQ4nMzipXcZ9THqs65PIL0q
|
29
29
|
eabwpCbAopo=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2013-
|
31
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: forgery
|
metadata.gz.sig
CHANGED
Binary file
|