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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac87b8766d97e1d50f4607e276e4ee194ff07029
4
- data.tar.gz: c8ae74db101314bc7afa4a3e6b4c1a4b1963192e
3
+ metadata.gz: 25c972ff8dad7d8864ffa4d17f4f45a2b8b9c6d2
4
+ data.tar.gz: 1bd94f62bd64cdb8dab318fd42586664cfb09b73
5
5
  SHA512:
6
- metadata.gz: b720b3220dbe051c23de1bdb7bc4ac928a5812136f148b71df660cb20eb202520f21e8320aa73b6b06b73e6860bceca52720d7b78e67237efb713390836fcf98
7
- data.tar.gz: e9cca22a42d524e8230f0e9d893e2dc4006d9862a9bc6775da2b80410b9b16f679214d9b20fa025582b3e2cb828ed93757d668eeeef0e7cf698f95fe83e06f26
6
+ metadata.gz: c2d73b7ad76274809593f8ceee8be6bdb10f5bab2789e375b9c71ddb089a4bd9bb5cba6d934697be9827afb24c0d97cee892292cf7e39664cd35a0efe021200b
7
+ data.tar.gz: 087fe327f716c62449d6a7b0acab185e09ae8251bbfef0e14ae4cc24570345d6be04036020d21ba5e6392c7592e4a2743a36ddb24ab27c57c772753f171c96eb
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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 = Time.now.to_a.values_at 3,4,5
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
- end
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.1.9
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
- 8ixkARkWAmV1MB4XDTE0MDIxNTAwNDMzOVoXDTE1MDIxNTAwNDMzOVowSDESMBAG
15
+ 8ixkARkWAmV1MB4XDTE1MDUyNjEwMzg1N1oXDTE2MDUyNTEwMzg1N1owSDESMBAG
16
16
  A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
17
  EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBALb/IcOGgkOkNbmPUoRpw6sb2Vcr9446xPFR8lvzxASOdXGHrhTsXQM9DHiC
19
- T1ZHPes3sa+aTnXVL4WdpaMPRiFFu7qugCbcaAB4wpiPvPTKXAAyRc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xIbGyIOQykHgA1XNDJomnS0oc5fstyGRunV+X0InCfg/ckgo
29
- ePLVnqoLKT1V+idsL4/tpYEl1GssHSh+cEAd9X8xbHpDnNt01TNSbh4pipB8Ea8S
30
- MZ4qsZhMdgi/Iq2f84oKlVtjiRxxmmb48MlHZByELP4g5ZKQFrZplmQyuzWVcjqU
31
- rGghecp8JqIaUMAdC4BGAk9sovzQGa3E4XUZ30J5rO7ViOudmTUOQ3NZ90Usvoyw
32
- HgARigdEjMspZA==
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAY9EdxP37
27
+ nuiKPJL9nqrar3cCdIh8FUu5kBR8kAztpF0D2Tfe43YyPluV2lHjje0kZcW8bn9s
28
+ ReXcsWkWUjr++JAO0RAdWVA1GO9BeyRc0sjyKnGrVqyIQls7AlXB4vsSIftMbasI
29
+ Ya4Iq/7PFt8M1cwutcJvz6Q1fS+n8BfmWtEC2xfJGPGOLJB0WTDoTqTWV+GsSEKZ
30
+ l736PGXhZBMYdr8KUsgO5wGBCXhz4o3sOtFqmCq5jJOxBFuOJ1+DT4t1hSiCRiSM
31
+ 7s9YWJUGwWFx0WEW7VLSKp3bM78JDg+8wlBvxT/TSFDiJIBzK016GlpIke8pVT4R
32
+ eTHFMg6pfobNKQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-06-07 00:00:00.000000000 Z
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.4
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.4
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.2.2
103
+ rubygems_version: 2.4.6
84
104
  signing_key:
85
105
  specification_version: 4
86
- summary: timetoday
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