business_time 0.10.0 → 0.11.0

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
  SHA256:
3
- metadata.gz: cb1621dd19416fb58fba1a2dcaff32e65542e29e18d09fdea0a9d7dca621f132
4
- data.tar.gz: ef8f7a0816e6e1df588a3e14424894b397df07e4217718594dd109c6c2bc4aaf
3
+ metadata.gz: e917428c31758c1ce02b1bfae4f1ab3c864e8b3eb3f12ec3556445c390506820
4
+ data.tar.gz: 1f8020bef45cdbdb1981fe9452633a427a202c7bc4d4f3390ca955b8f6c7a49c
5
5
  SHA512:
6
- metadata.gz: fa4d68c497aa80d701692dc5182837603e8cd66cdef810298fb727f29b65d5c92b22da9b3ce5a6f1c5e4533551b3de1b4a7591931c1f68dc3c0e1dde8b62dd66
7
- data.tar.gz: a62611ad7ac045fa795a98eaca9fed77a86725bc09a87e4941290ad2f7bda3a3851756fc22d609b802fadfc122440945f58f6bc240140bcd6bc19c0b21820ecf
6
+ metadata.gz: 8ffe3ada04985e1f12d6eb8c011e6dcfd4c09f02dc589e82e73fac1571af3caad6c52c2e80d7e312eb05cbdf5eda1ce39a251e6df2378d389f9fc49884ab7a5c
7
+ data.tar.gz: 1c244d0e42b7222422e5b6d2317aa1bdf9f5339ee71cae551c7c9a406add3b84dc6eed57e8d58e19a21dce10af10ba96e521eeb124a327510ea1827a17d9e2c0
data/README.rdoc CHANGED
@@ -61,6 +61,11 @@ We can adjust the start and end time of our business hours
61
61
  BusinessTime::Config.beginning_of_workday = "8:30 am"
62
62
  BusinessTime::Config.end_of_workday = "5:30 pm"
63
63
 
64
+ Or we can temporarily override the configured values
65
+ BusinessTime::Config.with(beginning_of_workday: "8 am", end_of_workday: "6 pm") do
66
+ 1.business_hour.from_now
67
+ end
68
+
64
69
  and we can add holidays that don't count as business days
65
70
  July 5 in 2010 is a monday that the U.S. takes off because our independence day falls on that Sunday.
66
71
  three_day_weekend = Date.parse("July 5th, 2010")
@@ -166,6 +171,7 @@ Timezone relative date handling gets more and more complicated every time you lo
166
171
 
167
172
  == Contributors
168
173
  * David Bock http://github.com/bokmann
174
+ * Ryan McGeary http://github.com/rmm5t
169
175
  * Enrico Bianco http://github.com/enricob
170
176
  * Arild Shirazi http://github.com/ashirazi
171
177
  * Piotr Jakubowski http://github.com/piotrj
@@ -186,13 +186,18 @@ module BusinessTime
186
186
 
187
187
  private
188
188
 
189
+ DAY_NAMES = [
190
+ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
191
+ ]
192
+ private_constant :DAY_NAMES
193
+
189
194
  def wday_to_int day_name
190
- lowercase_day_names = ::Time::RFC2822_DAY_NAME.map(&:downcase)
195
+ lowercase_day_names = DAY_NAMES.map(&:downcase)
191
196
  lowercase_day_names.find_index(day_name.to_s.downcase)
192
197
  end
193
198
 
194
199
  def int_to_wday num
195
- ::Time::RFC2822_DAY_NAME.map(&:downcase).map(&:to_sym)[num]
200
+ DAY_NAMES.map(&:downcase).map(&:to_sym)[num]
196
201
  end
197
202
 
198
203
  def reset
@@ -1,3 +1,3 @@
1
1
  module BusinessTime
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: business_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bokmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.2.11
154
+ rubygems_version: 3.2.31
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Support for doing time math in business hours and days