before_and_after 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -9,22 +9,26 @@ befoce_and_after adds the methods (before?, after?, within_last?, within_coming?
9
9
  2.minutes.ago.within_last?(2.hours) # => true
10
10
 
11
11
  2.minutes.from_now.within_coming?(2.hours) # => true
12
-
12
+
13
+ Example of where it really improves readability
14
+
15
+ email.sent_at.within_last?(48.hours)
16
+
17
+ vs
18
+
19
+ email.sent_at > Time.now - 48.hours
20
+
13
21
  Credits goes to whoever wrote this. http://www.dzone.com/snippets/and-after-ruby-time-class
14
22
 
15
- ## Contributing to before_and_after
16
-
17
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
18
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
19
- * Fork the project.
20
- * Start a feature/bugfix branch.
21
- * Commit and push until you are happy with your contribution.
22
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
23
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
23
+ ## Changelog
24
+
25
+ **1.0.1**
26
+
27
+ - Fixed so that we always use the same time NOW
24
28
 
25
29
  ## Copyright
26
30
 
27
- Copyright (c) 2013 Björn Blomqvist. See LICENSE.txt for
31
+ Copyright (c) 2013 - 2014 Björn Blomqvist. See LICENSE.txt for
28
32
  further details.
29
33
 
30
34
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -0,0 +1,60 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "before_and_after"
8
+ s.version = "1.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Darwin"]
12
+ s.date = "2014-12-15"
13
+ s.description = "It adds the methods (before?, after?, within_last?, within_coming?) to Time "
14
+ s.email = "darwin.git@marianna.se"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "before_and_after.gemspec",
29
+ "lib/before_and_after.rb",
30
+ "spec/before_and_after_spec.rb",
31
+ "spec/spec_helper.rb"
32
+ ]
33
+ s.homepage = "http://github.com/bjornblomqvist/before_and_after"
34
+ s.licenses = ["MIT"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = "1.8.24"
37
+ s.summary = "It adds the methods (before?, after?, within_last?, within_coming?) to Time"
38
+
39
+ if s.respond_to? :specification_version then
40
+ s.specification_version = 3
41
+
42
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
44
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
45
+ s.add_development_dependency(%q<bundler>, [">= 0"])
46
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
47
+ else
48
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
49
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
50
+ s.add_dependency(%q<bundler>, [">= 0"])
51
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
55
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
56
+ s.add_dependency(%q<bundler>, [">= 0"])
57
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
58
+ end
59
+ end
60
+
@@ -24,7 +24,8 @@ module BeforeAndAfter
24
24
  # 2.minutes.ago.within_last?(2.hours)
25
25
  #
26
26
  def within_last?(time_span)
27
- self.between?(Time.now - time_span, Time.now)
27
+ now = Time.now
28
+ self.between?(now - time_span, now)
28
29
  end
29
30
 
30
31
  # * +time_span+ - time span in seconds
@@ -32,7 +33,8 @@ module BeforeAndAfter
32
33
  # 2.minutes.from_now.within_coming?(2.hours)
33
34
  #
34
35
  def within_coming?(time_span)
35
- self.between?(Time.now, Time.now + time_span)
36
+ now = Time.now
37
+ self.between?(now, now + time_span)
36
38
  end
37
39
 
38
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.0
4
+ version: 1.0.1
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: 2013-06-17 00:00:00.000000000 Z
12
+ date: 2014-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -92,6 +92,7 @@ files:
92
92
  - README.md
93
93
  - Rakefile
94
94
  - VERSION
95
+ - before_and_after.gemspec
95
96
  - lib/before_and_after.rb
96
97
  - spec/before_and_after_spec.rb
97
98
  - spec/spec_helper.rb
@@ -110,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
111
  version: '0'
111
112
  segments:
112
113
  - 0
113
- hash: 1085368637549073758
114
+ hash: 1321121144630708544
114
115
  required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  none: false
116
117
  requirements: