increments-schedule 0.5.0 → 0.6.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
  SHA1:
3
- metadata.gz: f3251963d1b77cb0e04a98a148b6f02483cf37b2
4
- data.tar.gz: 0a9b9ac035fec9425ca749825a9ec3aee07fc049
3
+ metadata.gz: 2d7e3034c8853e9c5cf290df2cf51453d0055096
4
+ data.tar.gz: a28ec247dd1b0ff5336a693b2b2087938ffca1e9
5
5
  SHA512:
6
- metadata.gz: a013a38c8091ba7c49e885f94bf26238c820648f960036dd2be167969f4583c26dd1c4cc368b145cbf192f382db0a485d48c645eb3d9f61b8bbaf312069f00d1
7
- data.tar.gz: 8fd02b4216c64ddf61679cdb01a5cffd2109173a167e4ebbabe6afa7770c1f4abdff9340cd0fbf1eb44a47378f346956e1b6cd679dbe2d17fb892a517afc7bcb
6
+ metadata.gz: 457aa3c3a82dd5a56f7438a26d50c771c482b80db63e95de91060cf306799ad553584351377261169f18516d4b50111c02fd82a4af8e9190a87e968b9f845fbc
7
+ data.tar.gz: 7b033a4448f31e79f11d8ca4d499789d8c89d032b7eb348b2093035f598ec8d913a5918117e4f448ecde3c121035960282bf38143dd222631425900bdcf8ae39
data/README.md CHANGED
@@ -53,6 +53,7 @@ $ gem install increments-schedule
53
53
  * `Increments::Schedule.each_rest_day(max_date = Date.today + 365)`
54
54
  * `Increments::Schedule.each_weekend(max_date = Date.today + 365)`
55
55
  * `Increments::Schedule.each_holiday(max_date = Date.today + 365)`
56
+ * `Increments::Schedule.each_work_time_range(max_date = Date.today + 365)`
56
57
 
57
58
  ## Development
58
59
 
@@ -65,10 +65,26 @@ module Increments
65
65
  end
66
66
  end
67
67
 
68
+ def each_work_time_range(max_date = nil)
69
+ return to_enum(__method__, max_date) unless block_given?
70
+
71
+ each_work_day(max_date) do |work_day|
72
+ yield opening_time_of_date(work_day)..closing_time_of_date(work_day)
73
+ end
74
+ end
75
+
68
76
  private
69
77
 
70
78
  def normal_office_work_day?(date = Date.today)
71
79
  !rest_day?(date) && !normal_remote_work_day?(date)
72
80
  end
81
+
82
+ def opening_time_of_date(date)
83
+ date.to_time + 10 * 60 * 60
84
+ end
85
+
86
+ def closing_time_of_date(date)
87
+ date.to_time + 19 * 60 * 60
88
+ end
73
89
  end
74
90
  end
@@ -1,5 +1,5 @@
1
1
  module Increments
2
2
  module Schedule
3
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: increments-schedule
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: holiday_japan