working_hours 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +7 -1
- data/README.md +1 -1
- data/lib/working_hours/core_ext/date_and_time.rb +19 -10
- data/lib/working_hours/version.rb +1 -1
- 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: 2195f888fd66910d51526ea5b6a25af72ec6d1a2
|
4
|
+
data.tar.gz: 7177da2b9c2c3601a33246337890a43ce97587fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cb8260c4fec9542faf69153ff77ad91c960dbba662a3ce86d97ca359db66c22b001254f2f17a22ef526f93d990c71f57fe4ef820d8ac2cc3954f20162307197
|
7
|
+
data.tar.gz: bbd6f896e77168371168e96a3f6c298f37011a67e1e348de274fe343c6a480a45a29f81d2170737e7eef05990e4a6b70889e907855b3e4f8a223e1bdb1a092ce
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
-
[Compare master with v1.0.
|
3
|
+
[Compare master with v1.0.2](https://github.com/intrepidd/working_hours/compare/v1.0.2...master)
|
4
|
+
|
5
|
+
# v1.0.2
|
6
|
+
|
7
|
+
* Dropped use of `prepend` in favor of `alias_method` for core extensions to increase compability with jruby.
|
8
|
+
|
9
|
+
_15/10/2014_
|
4
10
|
|
5
11
|
# v1.0.1
|
6
12
|
|
data/README.md
CHANGED
@@ -135,7 +135,7 @@ end
|
|
135
135
|
|
136
136
|
## Timezones
|
137
137
|
|
138
|
-
This gem uses a simple but efficient approach in dealing with timezones. When you define your working hours **you have to choose** a
|
138
|
+
This gem uses a simple but efficient approach in dealing with timezones. When you define your working hours **you have to choose** a timezone associated with it (in the config example, the working hours are in Paris time). Then, any time used in calcultation will be converted to this timezone first, so you don't have to worry if your times are local or UTC as long as they are correct :)
|
139
139
|
|
140
140
|
## Alternatives
|
141
141
|
|
@@ -5,19 +5,28 @@ module WorkingHours
|
|
5
5
|
module CoreExt
|
6
6
|
module DateAndTime
|
7
7
|
|
8
|
-
def
|
9
|
-
|
8
|
+
def self.included base
|
9
|
+
base.class_eval do
|
10
|
+
alias_method :minus_without_working_hours, :-
|
11
|
+
alias_method :-, :minus_with_working_hours
|
12
|
+
alias_method :plus_without_working_hours, :+
|
13
|
+
alias_method :+, :plus_with_working_hours
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def plus_with_working_hours(other)
|
18
|
+
if WorkingHours::Duration === other
|
10
19
|
other.since(self)
|
11
20
|
else
|
12
|
-
|
21
|
+
plus_without_working_hours(other)
|
13
22
|
end
|
14
23
|
end
|
15
24
|
|
16
|
-
def
|
17
|
-
if
|
25
|
+
def minus_with_working_hours(other)
|
26
|
+
if WorkingHours::Duration === other
|
18
27
|
other.until(self)
|
19
28
|
else
|
20
|
-
|
29
|
+
minus_without_working_hours(other)
|
21
30
|
end
|
22
31
|
end
|
23
32
|
|
@@ -41,17 +50,17 @@ module WorkingHours
|
|
41
50
|
end
|
42
51
|
|
43
52
|
class Date
|
44
|
-
|
53
|
+
include WorkingHours::CoreExt::DateAndTime
|
45
54
|
end
|
46
55
|
|
47
56
|
class DateTime
|
48
|
-
|
57
|
+
include WorkingHours::CoreExt::DateAndTime
|
49
58
|
end
|
50
59
|
|
51
60
|
class Time
|
52
|
-
|
61
|
+
include WorkingHours::CoreExt::DateAndTime
|
53
62
|
end
|
54
63
|
|
55
64
|
class ActiveSupport::TimeWithZone
|
56
|
-
|
65
|
+
include WorkingHours::CoreExt::DateAndTime
|
57
66
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: working_hours
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Jarthon
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
12
|
+
date: 2014-10-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|