time_clock 0.0.4 → 0.0.5

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: babe06df41691e4bfa105124372803ef96d71995
4
- data.tar.gz: d692fc974a0a291fa2911928da89bacbb98955c5
3
+ metadata.gz: a39c9a2a4373b615a534f862ca1ac2da09124c2a
4
+ data.tar.gz: d0b2c40de9287b35f4aeed267fdb0c40f3bb73ac
5
5
  SHA512:
6
- metadata.gz: 6e73c6bf974f56c9da16a08cad18e0617c8e7a07a897071bfb4c2060094615d3872a60df6c923f95c0367ee69988b54acf53dc05f25536e11e8f5b4491d0b906
7
- data.tar.gz: 83bf1f7ae28bf2eaad174d7d68312aedeec775a896f67d0edccbdf91d87085bf5973044e95d5253aa1075a237168c3a056588cb13961ec57daf7e20bbe481fa2
6
+ metadata.gz: c26555cb8e3cfc1fc800e727115cfb41d840bf5784783a1d3d0a1485f79614906172aff8b61c8c0ca16ffd35aa759160e6c0e4c80df50355cc97243d016a9f6d
7
+ data.tar.gz: 01edb495fd7e2f6833210c6be9fecb5c275a8d45db457dd18785c777762f314b507435d9b09a8f0fceb5d16abeab0bfb13af03d62cf93634160111f89687eb61
@@ -0,0 +1,15 @@
1
+ module TimeClock
2
+ module BusinessTimeUntil
3
+ def business_seconds_until(time)
4
+ TimeClock::Comparison.new(self, time).seconds.to_i
5
+ end
6
+
7
+ def business_minutes_until(time)
8
+ (business_seconds_until(time).to_f / 60).ceil
9
+ end
10
+
11
+ def business_hours_until(time)
12
+ (business_seconds_until(time).to_f / 3600).ceil
13
+ end
14
+ end
15
+ end
@@ -1,15 +1,3 @@
1
1
  class Time
2
-
3
- def business_seconds_until(time)
4
- TimeClock::Comparison.new(self.to_time, time).seconds.to_i
5
- end
6
-
7
- def business_minutes_until(time)
8
- (business_seconds_until(time).to_f / 60).ceil
9
- end
10
-
11
- def business_hours_until(time)
12
- (business_seconds_until(time).to_f / 3600).ceil
13
- end
14
-
15
- end
2
+ include TimeClock::BusinessTimeUntil
3
+ end
@@ -0,0 +1,3 @@
1
+ if defined?(ActiveSupport::TimeWithZone)
2
+ ActiveSupport::TimeWithZone.include(TimeClock::BusinessTimeUntil)
3
+ end
@@ -1,3 +1,3 @@
1
1
  module TimeClock
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/time_clock.rb CHANGED
@@ -4,6 +4,8 @@ require "time_clock/shift"
4
4
  require "time_clock/calendar"
5
5
  require "time_clock/comparison"
6
6
 
7
+ require "time_clock/business_time_until"
8
+
7
9
  require "time_clock/core_ext/time"
8
10
 
9
11
  module TimeClock
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_clock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - barelyknown
@@ -123,9 +123,11 @@ files:
123
123
  - README.md
124
124
  - Rakefile
125
125
  - lib/time_clock.rb
126
+ - lib/time_clock/business_time_until.rb
126
127
  - lib/time_clock/calendar.rb
127
128
  - lib/time_clock/comparison.rb
128
129
  - lib/time_clock/core_ext/time.rb
130
+ - lib/time_clock/core_ext/time_with_zone.rb
129
131
  - lib/time_clock/shift.rb
130
132
  - lib/time_clock/version.rb
131
133
  - spec/lib/time_clock/calendar_spec.rb