before_and_after 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/VERSION +1 -1
- data/before_and_after.gemspec +2 -2
- data/lib/before_and_after.rb +6 -6
- metadata +3 -3
data/README.md
CHANGED
@@ -22,6 +22,10 @@ Credits goes to whoever wrote this. http://www.dzone.com/snippets/and-after-ruby
|
|
22
22
|
|
23
23
|
## Changelog
|
24
24
|
|
25
|
+
**1.0.2**
|
26
|
+
|
27
|
+
- Fixed problem with ActiveSupport::TimeWithZone between not behaving the same as Time#between
|
28
|
+
|
25
29
|
**1.0.1**
|
26
30
|
|
27
31
|
- Fixed so that we always use the same time NOW
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/before_and_after.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "before_and_after"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Darwin"]
|
12
|
-
s.date = "2014-12-
|
12
|
+
s.date = "2014-12-20"
|
13
13
|
s.description = "It adds the methods (before?, after?, within_last?, within_coming?) to Time "
|
14
14
|
s.email = "darwin.git@marianna.se"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/before_and_after.rb
CHANGED
@@ -8,7 +8,7 @@ module BeforeAndAfter
|
|
8
8
|
# Time.now.before?(2.hours.from_now)
|
9
9
|
#
|
10
10
|
def before?(input_time)
|
11
|
-
(self <=> input_time) == -1
|
11
|
+
(self.utc <=> input_time.utc) == -1
|
12
12
|
end
|
13
13
|
|
14
14
|
# * +input_time+ - time to compare
|
@@ -16,7 +16,7 @@ module BeforeAndAfter
|
|
16
16
|
# Time.now.after?(2.hours.ago)
|
17
17
|
#
|
18
18
|
def after?(input_time)
|
19
|
-
(self <=> input_time) == 1
|
19
|
+
(self.utc <=> input_time.utc) == 1
|
20
20
|
end
|
21
21
|
|
22
22
|
# * +time_span+ - time span in seconds
|
@@ -24,8 +24,8 @@ module BeforeAndAfter
|
|
24
24
|
# 2.minutes.ago.within_last?(2.hours)
|
25
25
|
#
|
26
26
|
def within_last?(time_span)
|
27
|
-
now = Time.now
|
28
|
-
self.between?(now - time_span, now)
|
27
|
+
now = Time.now.utc
|
28
|
+
self.utc.between?(now - time_span, now)
|
29
29
|
end
|
30
30
|
|
31
31
|
# * +time_span+ - time span in seconds
|
@@ -33,8 +33,8 @@ module BeforeAndAfter
|
|
33
33
|
# 2.minutes.from_now.within_coming?(2.hours)
|
34
34
|
#
|
35
35
|
def within_coming?(time_span)
|
36
|
-
now = Time.now
|
37
|
-
self.between?(now, now + time_span)
|
36
|
+
now = Time.now.utc
|
37
|
+
self.utc.between?(now, now + time_span)
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: before_and_after
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
12
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
segments:
|
113
113
|
- 0
|
114
|
-
hash:
|
114
|
+
hash: 936214884319017035
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|