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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af58b9235b85d46bc35cc76ceb72bf755c074923
4
- data.tar.gz: dd5e22bc13e5659507f189ed586327a9ad199f5b
3
+ metadata.gz: 2195f888fd66910d51526ea5b6a25af72ec6d1a2
4
+ data.tar.gz: 7177da2b9c2c3601a33246337890a43ce97587fa
5
5
  SHA512:
6
- metadata.gz: e09fc30b112ad6a69e45b64b6b0559ab82a4b09137c89a5598b86c22e3a2bc4f371790d9a941d0fb5bf993ed18248e8975c4ca01310ff0099bc88c3b734298fe
7
- data.tar.gz: e6312bdfccd80b1a19ffe5f8bb48a0c461bc71f0fa821fa1cd9b203780f72ab72c7c023e5bfa7e0b730eca3a1d596ddb312782d3c83a08326f83bd32107af010
6
+ metadata.gz: 2cb8260c4fec9542faf69153ff77ad91c960dbba662a3ce86d97ca359db66c22b001254f2f17a22ef526f93d990c71f57fe4ef820d8ac2cc3954f20162307197
7
+ data.tar.gz: bbd6f896e77168371168e96a3f6c298f37011a67e1e348de274fe343c6a480a45a29f81d2170737e7eef05990e4a6b70889e907855b3e4f8a223e1bdb1a092ce
data/.travis.yml CHANGED
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
- - 2.1.2
4
+ - 2.1.3
5
5
  - ruby-head
6
+ - jruby-head
6
7
  gemfile:
7
8
  - gemfiles/Gemfile.activesupport-3.2.x
8
9
  - gemfiles/Gemfile.activesupport-4.0.x
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Unreleased
2
2
 
3
- [Compare master with v1.0.1](https://github.com/intrepidd/working_hours/compare/v1.0.1...master)
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 timezome 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 :)
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 +(other)
9
- if (other.is_a?(WorkingHours::Duration))
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
- super(other)
21
+ plus_without_working_hours(other)
13
22
  end
14
23
  end
15
24
 
16
- def -(other)
17
- if (other.is_a?(WorkingHours::Duration))
25
+ def minus_with_working_hours(other)
26
+ if WorkingHours::Duration === other
18
27
  other.until(self)
19
28
  else
20
- super(other)
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
- prepend WorkingHours::CoreExt::DateAndTime
53
+ include WorkingHours::CoreExt::DateAndTime
45
54
  end
46
55
 
47
56
  class DateTime
48
- prepend WorkingHours::CoreExt::DateAndTime
57
+ include WorkingHours::CoreExt::DateAndTime
49
58
  end
50
59
 
51
60
  class Time
52
- prepend WorkingHours::CoreExt::DateAndTime
61
+ include WorkingHours::CoreExt::DateAndTime
53
62
  end
54
63
 
55
64
  class ActiveSupport::TimeWithZone
56
- prepend WorkingHours::CoreExt::DateAndTime
65
+ include WorkingHours::CoreExt::DateAndTime
57
66
  end
@@ -1,3 +1,3 @@
1
1
  module WorkingHours
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  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.1
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-10 00:00:00.000000000 Z
12
+ date: 2014-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport