biz 1.2.1 → 1.2.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: 1d05e74b61bbcd76562d54907d90b90252579da8
4
- data.tar.gz: b30af6939b9302e91d00e10289da02ef4ea87bbf
3
+ metadata.gz: e58755b16da3f9c2c9de70bcc5936254292f7a0b
4
+ data.tar.gz: 91739dad8b667cdd079e87b4f4cadf67b01f53cd
5
5
  SHA512:
6
- metadata.gz: ce1f8adb07629077dd1a6f9d9f9f297a993792de30d362960ea2b690cee778c6f320f1ffdcf75ad5196a0dbb0eaea086a3c5d4cc51926475b3aa8aa768c7db26
7
- data.tar.gz: e78efec99aeb0175351750d4354930e061961287dacfd00c20b6a7fb49bd8c46d7651b337d31e2722e70e4d101a07b3059b26512451dfa6785ce5f3c48dea943
6
+ metadata.gz: 727209e4febee006be3c79846a4e577f4c14ca2b942cf7cc1e5fcb9cb7fc8e34e4f16fad8128eb8485abd43b5e48db5cb44214d49e616c07272775ff27a3cbfe
7
+ data.tar.gz: 357bc50b2a8411d2516bbf0bedb5dc3b9535fc9a81677f0d67303a8e276bfa15f9adc738f7c05ecb5f3bf1b68d41ea3640bc984f9673ba49d5ad8d89a098ca4a
@@ -53,7 +53,6 @@ module Biz
53
53
 
54
54
  Raw = Struct.new(:hours, :holidays, :time_zone) do
55
55
  module Default
56
-
57
56
  HOURS = {
58
57
  mon: {'09:00' => '17:00'},
59
58
  tue: {'09:00' => '17:00'},
@@ -63,7 +62,6 @@ module Biz
63
62
  }
64
63
  HOLIDAYS = []
65
64
  TIME_ZONE = 'Etc/UTC'
66
-
67
65
  end
68
66
 
69
67
  def initialize(*)
@@ -1,11 +1,9 @@
1
1
  module Biz
2
2
  module CoreExt
3
3
  module Date
4
-
5
4
  def business_day?
6
5
  Biz.dates.active?(self)
7
6
  end
8
-
9
7
  end
10
8
  end
11
9
  end
@@ -1,11 +1,9 @@
1
1
  module Biz
2
2
  module CoreExt
3
3
  module Fixnum
4
-
5
4
  Calculation::ForDuration::UNITS.each do |unit|
6
5
  define_method("business_#{unit}") { Biz.time(self, unit) }
7
6
  end
8
-
9
7
  end
10
8
  end
11
9
  end
@@ -1,11 +1,9 @@
1
1
  module Biz
2
2
  module CoreExt
3
3
  module Time
4
-
5
4
  def business_hours?
6
5
  Biz.in_hours?(self)
7
6
  end
8
-
9
7
  end
10
8
  end
11
9
  end
data/lib/biz/day_time.rb CHANGED
@@ -2,10 +2,8 @@ module Biz
2
2
  class DayTime
3
3
 
4
4
  module Timestamp
5
-
6
5
  FORMAT = '%02d:%02d'
7
6
  PATTERN = /\A(?<hour>\d{2}):(?<minute>\d{2})(:?(?<second>\d{2}))?\Z/
8
-
9
7
  end
10
8
 
11
9
  include Comparable
data/lib/biz/periods.rb CHANGED
@@ -1,22 +1,5 @@
1
1
  module Biz
2
- class Periods
3
-
4
- def initialize(schedule)
5
- @schedule = schedule
6
- end
7
-
8
- def after(origin)
9
- After.new(schedule, origin)
10
- end
11
-
12
- def before(origin)
13
- Before.new(schedule, origin)
14
- end
15
-
16
- protected
17
-
18
- attr_reader :schedule
19
-
2
+ module Periods
20
3
  end
21
4
  end
22
5
 
@@ -24,3 +7,4 @@ require 'biz/periods/abstract'
24
7
 
25
8
  require 'biz/periods/after'
26
9
  require 'biz/periods/before'
10
+ require 'biz/periods/proxy'
@@ -1,5 +1,5 @@
1
1
  module Biz
2
- class Periods
2
+ module Periods
3
3
  class Abstract < Enumerator::Lazy
4
4
 
5
5
  extend Forwardable
@@ -14,7 +14,7 @@ module Biz
14
14
  delegate time_zone: :schedule
15
15
 
16
16
  def timeline
17
- Timeline.new(self)
17
+ Timeline::Proxy.new(self)
18
18
  end
19
19
 
20
20
  protected
@@ -1,5 +1,5 @@
1
1
  module Biz
2
- class Periods
2
+ module Periods
3
3
  class After < Abstract
4
4
 
5
5
  def timeline
@@ -1,5 +1,5 @@
1
1
  module Biz
2
- class Periods
2
+ module Periods
3
3
  class Before < Abstract
4
4
 
5
5
  def timeline
@@ -0,0 +1,23 @@
1
+ module Biz
2
+ module Periods
3
+ class Proxy
4
+
5
+ def initialize(schedule)
6
+ @schedule = schedule
7
+ end
8
+
9
+ def after(origin)
10
+ After.new(schedule, origin)
11
+ end
12
+
13
+ def before(origin)
14
+ Before.new(schedule, origin)
15
+ end
16
+
17
+ protected
18
+
19
+ attr_reader :schedule
20
+
21
+ end
22
+ end
23
+ end
data/lib/biz/schedule.rb CHANGED
@@ -15,7 +15,7 @@ module Biz
15
15
  ] => :configuration
16
16
 
17
17
  def periods
18
- Periods.new(self)
18
+ Periods::Proxy.new(self)
19
19
  end
20
20
 
21
21
  def dates
data/lib/biz/timeline.rb CHANGED
@@ -1,22 +1,5 @@
1
1
  module Biz
2
- class Timeline
3
-
4
- def initialize(periods)
5
- @periods = periods
6
- end
7
-
8
- def forward
9
- Forward.new(periods)
10
- end
11
-
12
- def backward
13
- Backward.new(periods)
14
- end
15
-
16
- protected
17
-
18
- attr_reader :periods
19
-
2
+ module Timeline
20
3
  end
21
4
  end
22
5
 
@@ -24,3 +7,4 @@ require 'biz/timeline/abstract'
24
7
 
25
8
  require 'biz/timeline/forward'
26
9
  require 'biz/timeline/backward'
10
+ require 'biz/timeline/proxy'
@@ -1,5 +1,5 @@
1
1
  module Biz
2
- class Timeline
2
+ module Timeline
3
3
  class Abstract
4
4
 
5
5
  def initialize(periods)
@@ -1,5 +1,5 @@
1
1
  module Biz
2
- class Timeline
2
+ module Timeline
3
3
  class Backward < Abstract
4
4
 
5
5
  def backward
@@ -1,5 +1,5 @@
1
1
  module Biz
2
- class Timeline
2
+ module Timeline
3
3
  class Forward < Abstract
4
4
 
5
5
  def forward
@@ -0,0 +1,23 @@
1
+ module Biz
2
+ module Timeline
3
+ class Proxy
4
+
5
+ def initialize(periods)
6
+ @periods = periods
7
+ end
8
+
9
+ def forward
10
+ Forward.new(periods)
11
+ end
12
+
13
+ def backward
14
+ Backward.new(periods)
15
+ end
16
+
17
+ protected
18
+
19
+ attr_reader :periods
20
+
21
+ end
22
+ end
23
+ end
data/lib/biz/version.rb CHANGED
@@ -1,5 +1,3 @@
1
1
  module Biz
2
-
3
- VERSION = '1.2.1'
4
-
2
+ VERSION = '1.2.2'
5
3
  end
@@ -37,6 +37,7 @@ module Biz
37
37
  minute
38
38
  second
39
39
  day_minute
40
+ day_second
40
41
  timestamp
41
42
  ] => :day_time
42
43
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Little
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-23 00:00:00.000000000 Z
12
+ date: 2015-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: abstract_type
@@ -140,6 +140,7 @@ files:
140
140
  - lib/biz/periods/abstract.rb
141
141
  - lib/biz/periods/after.rb
142
142
  - lib/biz/periods/before.rb
143
+ - lib/biz/periods/proxy.rb
143
144
  - lib/biz/schedule.rb
144
145
  - lib/biz/time.rb
145
146
  - lib/biz/time_segment.rb
@@ -147,6 +148,7 @@ files:
147
148
  - lib/biz/timeline/abstract.rb
148
149
  - lib/biz/timeline/backward.rb
149
150
  - lib/biz/timeline/forward.rb
151
+ - lib/biz/timeline/proxy.rb
150
152
  - lib/biz/version.rb
151
153
  - lib/biz/week.rb
152
154
  - lib/biz/week_time.rb