week_of_month 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +27 -0
- data/Gemfile.lock +2 -2
- data/README.md +6 -0
- data/lib/modules/day.rb +4 -4
- data/lib/modules/month.rb +2 -2
- data/lib/modules/version.rb +1 -1
- data/lib/test/modules/date/test_month.rb +13 -13
- data/lib/test/modules/time/test_month.rb +13 -13
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4f5d3ac3dd42bdf728759af3f7a09c4a04754a8
|
4
|
+
data.tar.gz: 1fb63bdd66527a6e022b52041c71f22a22cd7580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eb5f7cc01466a71019a6c65878d35b459f46614ddc04a5e059e51aa1cb4671a802fa1e508691d2c1c6c35060dc57f5687426c84abf5417eaaa51cf029eb2c01
|
7
|
+
data.tar.gz: ca569ddc0fd0c09cbdb2011a82cc9f90c76d94cec2690acd288172fd8ec403891ef135a58fd7fa52cbf5f90f267cfeeda339abecb79223f274e8feb9f88c1f73
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
11
|
+
|
12
|
+
working_directory: ~/week-of-month
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
|
17
|
+
- run:
|
18
|
+
# install gems
|
19
|
+
name: install dependencies
|
20
|
+
command: |
|
21
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
22
|
+
|
23
|
+
# run tests!
|
24
|
+
- run:
|
25
|
+
name: run tests
|
26
|
+
command: |
|
27
|
+
bundle exec rake test
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
week_of_month (1.2.
|
4
|
+
week_of_month (1.2.5)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
test-unit (3.2.5)
|
31
31
|
power_assert
|
32
32
|
unicode-display_width (1.2.1)
|
33
|
-
yard (0.
|
33
|
+
yard (0.9.12)
|
34
34
|
|
35
35
|
PLATFORMS
|
36
36
|
ruby
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/week_of_month.svg)][gem]
|
4
4
|
[![Climate](https://codeclimate.com/github/sachin87/week-of-month.png)][climate]
|
5
5
|
[![License](http://img.shields.io/license/MIT.png?color=green)][license]
|
6
|
+
[![CircleCI](https://circleci.com/gh/sachin87/week-of-month.svg?style=svg)](https://circleci.com/gh/sachin87/week-of-month)
|
6
7
|
|
7
8
|
[gem]: http://badge.fury.io/rb/week_of_month
|
8
9
|
[climate]: https://codeclimate.com/github/sachin87/week-of-month
|
@@ -157,6 +158,11 @@ We believe strongly in not writing code unless we have to, so Week of month is b
|
|
157
158
|
|
158
159
|
## Version History
|
159
160
|
|
161
|
+
###1.2.5
|
162
|
+
|
163
|
+
Methods beginning_of_week and end_of_week renamed to
|
164
|
+
starting_of_week and ending_of_week.
|
165
|
+
|
160
166
|
###1.2.1
|
161
167
|
|
162
168
|
Support for Time class
|
data/lib/modules/day.rb
CHANGED
@@ -26,7 +26,7 @@ module WeekOfMonth
|
|
26
26
|
end
|
27
27
|
array = []
|
28
28
|
array[day] = 1
|
29
|
-
(2..
|
29
|
+
(2..ending_of_month.mday).each { |i| array << i }
|
30
30
|
array
|
31
31
|
end
|
32
32
|
|
@@ -90,7 +90,7 @@ module WeekOfMonth
|
|
90
90
|
# #<Date: 2014-12-03 ((2456995j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-02 ((2456994j,0s,0n),+0s,2299161j)>,
|
91
91
|
# #<Date: 2014-12-01 ((2456993j,0s,0n),+0s,2299161j)>]
|
92
92
|
def all_working_days_of_month
|
93
|
-
|
93
|
+
ending_of_month.downto(beginning_of_month).select(&:working_day?)
|
94
94
|
end
|
95
95
|
|
96
96
|
# returns array of all non working days of the month
|
@@ -100,14 +100,14 @@ module WeekOfMonth
|
|
100
100
|
# #<Date: 2014-12-14 ((2457006j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-13 ((2457005j,0s,0n),+0s,2299161j)>,
|
101
101
|
# #<Date: 2014-12-07 ((2456999j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-06 ((2456998j,0s,0n),+0s,2299161j)>]
|
102
102
|
def all_non_week_days_of_month
|
103
|
-
|
103
|
+
ending_of_month.downto(beginning_of_month).select(&:week_end?)
|
104
104
|
end
|
105
105
|
|
106
106
|
# returns first working/business day of the month
|
107
107
|
# Date.new(2014,12,1).first_working_day_of_the_month
|
108
108
|
# => #<Date: 2014-12-01 ((2456993j,0s,0n),+0s,2299161j)>
|
109
109
|
def first_working_day_of_the_month
|
110
|
-
beginning_of_month.upto(
|
110
|
+
beginning_of_month.upto(ending_of_month).find(&:working_day?)
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
data/lib/modules/month.rb
CHANGED
@@ -28,10 +28,10 @@ module WeekOfMonth
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# returns date of last day of month for a given date.
|
31
|
-
# Date.new(2012,11,1).
|
31
|
+
# Date.new(2012,11,1).ending_of_month
|
32
32
|
# => #<Date: 2012-11-30 ((2456262j,0s,0n),+0s,2299161j)>
|
33
33
|
# @return [Date]
|
34
|
-
def
|
34
|
+
def ending_of_month
|
35
35
|
self.class.new(year, month, last_day_of_month)
|
36
36
|
end
|
37
37
|
|
data/lib/modules/version.rb
CHANGED
@@ -62,30 +62,30 @@ class TestMonthForDate < Test::Unit::TestCase
|
|
62
62
|
assert_equal 31, Date.new(2012, 12, 31).last_day_of_month
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
66
|
-
assert_equal Date.new(2012, 1, 31), Date.new(2012, 1, 1).
|
65
|
+
def test_ending_of_month
|
66
|
+
assert_equal Date.new(2012, 1, 31), Date.new(2012, 1, 1).ending_of_month
|
67
67
|
|
68
|
-
assert_equal Date.new(2012, 2, 29), Date.new(2012, 2, 2).
|
68
|
+
assert_equal Date.new(2012, 2, 29), Date.new(2012, 2, 2).ending_of_month
|
69
69
|
|
70
|
-
assert_equal Date.new(2012, 3, 31), Date.new(2012, 3, 1).
|
70
|
+
assert_equal Date.new(2012, 3, 31), Date.new(2012, 3, 1).ending_of_month
|
71
71
|
|
72
|
-
assert_equal Date.new(2012, 4, 30), Date.new(2012, 4, 3).
|
72
|
+
assert_equal Date.new(2012, 4, 30), Date.new(2012, 4, 3).ending_of_month
|
73
73
|
|
74
|
-
assert_equal Date.new(2012, 5, 31), Date.new(2012, 5, 1).
|
74
|
+
assert_equal Date.new(2012, 5, 31), Date.new(2012, 5, 1).ending_of_month
|
75
75
|
|
76
|
-
assert_equal Date.new(2012, 6, 30), Date.new(2012, 6, 30).
|
76
|
+
assert_equal Date.new(2012, 6, 30), Date.new(2012, 6, 30).ending_of_month
|
77
77
|
|
78
|
-
assert_equal Date.new(2012, 7, 31), Date.new(2012, 7, 1).
|
78
|
+
assert_equal Date.new(2012, 7, 31), Date.new(2012, 7, 1).ending_of_month
|
79
79
|
|
80
|
-
assert_equal Date.new(2012, 8, 31), Date.new(2012, 8, 5).
|
80
|
+
assert_equal Date.new(2012, 8, 31), Date.new(2012, 8, 5).ending_of_month
|
81
81
|
|
82
|
-
assert_equal Date.new(2012, 9, 30), Date.new(2012, 9, 2).
|
82
|
+
assert_equal Date.new(2012, 9, 30), Date.new(2012, 9, 2).ending_of_month
|
83
83
|
|
84
|
-
assert_equal Date.new(2012, 10, 31), Date.new(2012, 10, 22).
|
84
|
+
assert_equal Date.new(2012, 10, 31), Date.new(2012, 10, 22).ending_of_month
|
85
85
|
|
86
|
-
assert_equal Date.new(2012, 11, 30), Date.new(2012, 11, 10).
|
86
|
+
assert_equal Date.new(2012, 11, 30), Date.new(2012, 11, 10).ending_of_month
|
87
87
|
|
88
|
-
assert_equal Date.new(2012, 12, 31), Date.new(2012, 12, 15).
|
88
|
+
assert_equal Date.new(2012, 12, 31), Date.new(2012, 12, 15).ending_of_month
|
89
89
|
end
|
90
90
|
|
91
91
|
def test_beginning_of_month
|
@@ -62,30 +62,30 @@ class TestMonthForTime < Test::Unit::TestCase
|
|
62
62
|
assert_equal 31, Time.new(2012, 12, 31).last_day_of_month
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
66
|
-
assert_equal Time.new(2012, 1, 31), Time.new(2012, 1, 1).
|
65
|
+
def test_ending_of_month
|
66
|
+
assert_equal Time.new(2012, 1, 31), Time.new(2012, 1, 1).ending_of_month
|
67
67
|
|
68
|
-
assert_equal Time.new(2012, 2, 29), Time.new(2012, 2, 2).
|
68
|
+
assert_equal Time.new(2012, 2, 29), Time.new(2012, 2, 2).ending_of_month
|
69
69
|
|
70
|
-
assert_equal Time.new(2012, 3, 31), Time.new(2012, 3, 1).
|
70
|
+
assert_equal Time.new(2012, 3, 31), Time.new(2012, 3, 1).ending_of_month
|
71
71
|
|
72
|
-
assert_equal Time.new(2012, 4, 30), Time.new(2012, 4, 3).
|
72
|
+
assert_equal Time.new(2012, 4, 30), Time.new(2012, 4, 3).ending_of_month
|
73
73
|
|
74
|
-
assert_equal Time.new(2012, 5, 31), Time.new(2012, 5, 1).
|
74
|
+
assert_equal Time.new(2012, 5, 31), Time.new(2012, 5, 1).ending_of_month
|
75
75
|
|
76
|
-
assert_equal Time.new(2012, 6, 30), Time.new(2012, 6, 30).
|
76
|
+
assert_equal Time.new(2012, 6, 30), Time.new(2012, 6, 30).ending_of_month
|
77
77
|
|
78
|
-
assert_equal Time.new(2012, 7, 31), Time.new(2012, 7, 1).
|
78
|
+
assert_equal Time.new(2012, 7, 31), Time.new(2012, 7, 1).ending_of_month
|
79
79
|
|
80
|
-
assert_equal Time.new(2012, 8, 31), Time.new(2012, 8, 5).
|
80
|
+
assert_equal Time.new(2012, 8, 31), Time.new(2012, 8, 5).ending_of_month
|
81
81
|
|
82
|
-
assert_equal Time.new(2012, 9, 30), Time.new(2012, 9, 2).
|
82
|
+
assert_equal Time.new(2012, 9, 30), Time.new(2012, 9, 2).ending_of_month
|
83
83
|
|
84
|
-
assert_equal Time.new(2012, 10, 31), Time.new(2012, 10, 22).
|
84
|
+
assert_equal Time.new(2012, 10, 31), Time.new(2012, 10, 22).ending_of_month
|
85
85
|
|
86
|
-
assert_equal Time.new(2012, 11, 30), Time.new(2012, 11, 10).
|
86
|
+
assert_equal Time.new(2012, 11, 30), Time.new(2012, 11, 10).ending_of_month
|
87
87
|
|
88
|
-
assert_equal Time.new(2012, 12, 31), Time.new(2012, 12, 15).
|
88
|
+
assert_equal Time.new(2012, 12, 31), Time.new(2012, 12, 15).ending_of_month
|
89
89
|
end
|
90
90
|
|
91
91
|
def test_beginning_of_month
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: week_of_month
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sachin87
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date:
|
20
|
+
date: 2019-03-29 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rake
|
@@ -70,6 +70,7 @@ extensions: []
|
|
70
70
|
extra_rdoc_files: []
|
71
71
|
files:
|
72
72
|
- ".bundle/install.log"
|
73
|
+
- ".circleci/config.yml"
|
73
74
|
- ".gitignore"
|
74
75
|
- ".rvmrc"
|
75
76
|
- Gemfile
|
@@ -121,4 +122,3 @@ signing_key:
|
|
121
122
|
specification_version: 4
|
122
123
|
summary: Week of month!
|
123
124
|
test_files: []
|
124
|
-
has_rdoc:
|