timetoday 0.1.9 → 0.2.0
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 +0 -0
- data.tar.gz.sig +0 -0
- data/lib/timetoday.rb +29 -3
- metadata +42 -21
- 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: 25c972ff8dad7d8864ffa4d17f4f45a2b8b9c6d2
|
4
|
+
data.tar.gz: 1bd94f62bd64cdb8dab318fd42586664cfb09b73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2d73b7ad76274809593f8ceee8be6bdb10f5bab2789e375b9c71ddb089a4bd9bb5cba6d934697be9827afb24c0d97cee892292cf7e39664cd35a0efe021200b
|
7
|
+
data.tar.gz: 087fe327f716c62449d6a7b0acab185e09ae8251bbfef0e14ae4cc24570345d6be04036020d21ba5e6392c7592e4a2743a36ddb24ab27c57c772753f171c96eb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/timetoday.rb
CHANGED
@@ -5,15 +5,22 @@
|
|
5
5
|
require 'date'
|
6
6
|
require 'time'
|
7
7
|
require 'chronic_duration'
|
8
|
+
require 'app-routes'
|
8
9
|
|
9
10
|
class TimeToday
|
11
|
+
include AppRoutes
|
12
|
+
|
13
|
+
def initialize()
|
14
|
+
super()
|
15
|
+
expressions()
|
16
|
+
end
|
10
17
|
|
11
|
-
def self.any()
|
18
|
+
def self.any(d=Date.today)
|
12
19
|
#seconds_in_day = (DateTime.now + 1).to_time - DateTime.now.to_time
|
13
20
|
seconds_in_day = 86399.999461942 # result from above
|
14
21
|
|
15
22
|
any_time = Time.at rand(seconds_in_day)
|
16
|
-
day, mon, year =
|
23
|
+
day, mon, year = d.day, d.month, d.year
|
17
24
|
s, min, hr = any_time.to_a.values_at 0,1,2
|
18
25
|
Time.new(year, mon, day, hr, min, s)
|
19
26
|
end
|
@@ -31,4 +38,23 @@ class TimeToday
|
|
31
38
|
def self.within(duration)
|
32
39
|
Time.now + rand(ChronicDuration.parse(duration))
|
33
40
|
end
|
34
|
-
|
41
|
+
|
42
|
+
def between(s)
|
43
|
+
expression = find_expression(s)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def expressions()
|
49
|
+
|
50
|
+
# e.g. 2-3 days
|
51
|
+
get /(\d+)\s*-\s*(\d+)\s+days/ do |n1, n2|
|
52
|
+
d = Date.today
|
53
|
+
tt = TimeToday
|
54
|
+
rand(tt.any(d+n1.to_i)..tt.any(d+n2.to_i)).to_time
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
alias find_expression run_route
|
59
|
+
|
60
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timetoday
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,27 +12,47 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE1MDUyNjEwMzg1N1oXDTE2MDUyNTEwMzg1N1owSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC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+DT4t1hSiCRiSM
|
31
|
+
7s9YWJUGwWFx0WEW7VLSKp3bM78JDg+8wlBvxT/TSFDiJIBzK016GlpIke8pVT4R
|
32
|
+
eTHFMg6pfobNKQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: app-routes
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.8
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.1.8
|
36
56
|
- !ruby/object:Gem::Dependency
|
37
57
|
name: chronic_duration
|
38
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,7 +62,7 @@ dependencies:
|
|
42
62
|
version: '0.10'
|
43
63
|
- - ">="
|
44
64
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.10.
|
65
|
+
version: 0.10.6
|
46
66
|
type: :runtime
|
47
67
|
prerelease: false
|
48
68
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,7 +72,7 @@ dependencies:
|
|
52
72
|
version: '0.10'
|
53
73
|
- - ">="
|
54
74
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.10.
|
75
|
+
version: 0.10.6
|
56
76
|
description:
|
57
77
|
email: james@r0bertson.co.uk
|
58
78
|
executables: []
|
@@ -80,8 +100,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
100
|
version: '0'
|
81
101
|
requirements: []
|
82
102
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.4.6
|
84
104
|
signing_key:
|
85
105
|
specification_version: 4
|
86
|
-
summary:
|
106
|
+
summary: Returns a random time today, or within a few days (e.g. "4 days"), or between
|
107
|
+
a few days (e.g. "2-3 days")
|
87
108
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|