timescopes 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/timescopes/scopes.rb +23 -0
- data/timescopes.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 689f4121b8b899b33942e22606c906f3f471dddd
|
4
|
+
data.tar.gz: 283f8832bf5b84fbce6bdac5ced5caa78ccdcbcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ca1edb7939a3ddec60b5bba16ae7f1b55ffa7533d4e0f53e50336f01dca0b1aa3029f926a789532c3d19b9214d31f0b28259eecaa6f6b02134d860df52ba272
|
7
|
+
data.tar.gz: 3ba29d4432ec6c82dd633b9e89272198e9f2b7dceebbad49f07c44f04d8cb3345635916c06a8af2f4ae41791bf037e14d6c0a9612895a66460dcf789d17038f8
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/lib/timescopes/scopes.rb
CHANGED
@@ -7,18 +7,21 @@ module TimeScopes
|
|
7
7
|
[ Chronic.parse(start_of_minute(start.utc)),
|
8
8
|
Chronic.parse(start_of_minute(1.minute.since(start.utc))) ]
|
9
9
|
end
|
10
|
+
alias_method :minute, :minutely
|
10
11
|
|
11
12
|
def hourly(start=nil)
|
12
13
|
start ||= Time.now
|
13
14
|
[ Chronic.parse(start_of_hour(start.utc)),
|
14
15
|
Chronic.parse(start_of_hour(1.hour.since(start.utc))) ]
|
15
16
|
end
|
17
|
+
alias_method :hour, :hourly
|
16
18
|
|
17
19
|
def daily(start=nil)
|
18
20
|
start ||= Time.now
|
19
21
|
[ Chronic.parse(start_of_day(start.utc)),
|
20
22
|
Chronic.parse(start_of_day(1.day.since(start.utc))) ]
|
21
23
|
end
|
24
|
+
alias_method :day, :daily
|
22
25
|
|
23
26
|
def weekly(start=nil)
|
24
27
|
start ||= Time.now
|
@@ -27,12 +30,28 @@ module TimeScopes
|
|
27
30
|
[ Chronic.parse(start_of_day(start.utc)),
|
28
31
|
Chronic.parse(start_of_day(1.week.since(start.utc))) ]
|
29
32
|
end
|
33
|
+
alias_method :week, :weekly
|
30
34
|
|
31
35
|
def monthly(start=nil)
|
32
36
|
start ||= Time.now
|
33
37
|
[ Chronic.parse(start_of_month(start.utc)),
|
34
38
|
Chronic.parse(start_of_month(1.month.since(start.utc))) ]
|
35
39
|
end
|
40
|
+
alias_method :month, :monthly
|
41
|
+
|
42
|
+
def monthly(start=nil)
|
43
|
+
start ||= Time.now
|
44
|
+
[ Chronic.parse(start_of_month(start.utc)),
|
45
|
+
Chronic.parse(start_of_month(1.month.since(start.utc))) ]
|
46
|
+
end
|
47
|
+
alias_method :month, :monthly
|
48
|
+
|
49
|
+
def yearly(start=nil)
|
50
|
+
start ||= Time.now
|
51
|
+
[ Chronic.parse(start_of_year(start.utc)),
|
52
|
+
Chronic.parse(start_of_year(1.year.since(start.utc))) ]
|
53
|
+
end
|
54
|
+
alias_method :year, :yearly
|
36
55
|
|
37
56
|
def overall(start=nil)
|
38
57
|
[ Chronic.parse('2000-01-01 00:00:00'),
|
@@ -54,5 +73,9 @@ module TimeScopes
|
|
54
73
|
def start_of_month(time)
|
55
74
|
time.strftime("%Y-%m-01 00:00:00Z")
|
56
75
|
end
|
76
|
+
|
77
|
+
def start_of_year(time)
|
78
|
+
time.strftime("%Y-01-01 00:00:00Z")
|
79
|
+
end
|
57
80
|
end
|
58
81
|
end
|
data/timescopes.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: timescopes 0.1.
|
5
|
+
# stub: timescopes 0.1.6 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "timescopes"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.6"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Ian Hunter"]
|
14
|
-
s.date = "2016-
|
14
|
+
s.date = "2016-05-18"
|
15
15
|
s.description = ""
|
16
16
|
s.email = "ianhunter@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timescopes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Hunter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|