week_of_month 1.2.4 → 1.2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d40697431c1fc812225cb4a515a10ead0d8067d
4
- data.tar.gz: c8db492be402a3e49f56be44243469c53bc8a809
3
+ metadata.gz: bd72520365390856541f0650e563846dedcdef9e
4
+ data.tar.gz: 46a05cdf73daee18d253b230f6d153fd1639ace3
5
5
  SHA512:
6
- metadata.gz: 697711cda4ebd22d70ab622fe2b60d0e586d3bb1f7adce50f2f0b9dbaef8f34f04174a6171f04fbf1ceaaecb46763b944c29bb5459d8d3ec0e4073476174f9b1
7
- data.tar.gz: be1cc754c4a01803ae4f83fc6fb707f8c8f059156ab9fe194bc0e35d1b36c49bc946ff7920c6aeb38e43ec2f9d729eb77cad10927b3d0d1ec8ee6631cd58fb6a
6
+ metadata.gz: aa9f23589d667f60ccf7b89a485378db695685c38dc2003a437f3b268d1d9c9ffa78849d4c86041df1e15c2a64a10b090ada706d661156a4bc9a1e32f47a21ad
7
+ data.tar.gz: 02d123663acea408c194177d8028977646dbc22d2ea6d1392f0a3a32443ac9ae606d26a88470eb45dd9d9f684fced8965a6976d5e99d0dafa8ce6a7f1c47cc88
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- week_of_month (1.2.3.4)
4
+ week_of_month (1.2.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -13,7 +13,7 @@ GEM
13
13
  parallel (1.11.2)
14
14
  parser (2.4.0.0)
15
15
  ast (~> 2.2)
16
- power_assert (0.4.1)
16
+ power_assert (1.1.0)
17
17
  powerpack (0.1.1)
18
18
  rainbow (2.2.2)
19
19
  rake
@@ -27,7 +27,7 @@ GEM
27
27
  ruby-progressbar (~> 1.7)
28
28
  unicode-display_width (~> 1.0, >= 1.0.1)
29
29
  ruby-progressbar (1.8.1)
30
- test-unit (3.2.3)
30
+ test-unit (3.2.5)
31
31
  power_assert
32
32
  unicode-display_width (1.2.1)
33
33
  yard (0.8.7.6)
@@ -36,14 +36,14 @@ PLATFORMS
36
36
  ruby
37
37
 
38
38
  DEPENDENCIES
39
- bundler (>= 1.15.0)
39
+ bundler (>= 1.15.4)
40
40
  byebug
41
41
  rake (>= 12.0.0)
42
42
  redcarpet
43
43
  rubocop
44
- test-unit (>= 3.2.3)
44
+ test-unit (>= 3.2.5)
45
45
  week_of_month!
46
46
  yard
47
47
 
48
48
  BUNDLED WITH
49
- 1.15.0
49
+ 1.15.4
@@ -36,6 +36,9 @@ module WeekOfMonth
36
36
  # array of ordered days names starting from sunday and ending with saturday.
37
37
  DAYS_IN_SEQUENCE = %w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday].freeze
38
38
 
39
+ # array of ordered days names starting from sunday and ending with saturday.
40
+ DAYS_IN_SEQUENCE_STARTING_MONDAY = %w[Monday Tuesday Wednesday Thursday Friday Saturday Sunday].freeze
41
+
39
42
  # array of ordered days names starting from sunday and ending with saturday.
40
43
  WEEKS_IN_SEQUENCE = %w[Last First Second Third Fourth Fifth].freeze
41
44
  end
@@ -21,7 +21,7 @@ module WeekOfMonth
21
21
  # @return [Array]
22
22
  def days_array
23
23
  day = beginning_of_month.to_date.wday
24
- if WeekOfMonth.configuration.monday_active == true
24
+ if WeekOfMonth.configuration.monday_active
25
25
  day = day.zero? ? 6 : day - 1
26
26
  end
27
27
  array = []
@@ -59,7 +59,11 @@ module WeekOfMonth
59
59
  DAYS_IN_SEQUENCE.each_with_index do |day_name, i|
60
60
  method_name = "all_#{day_name.downcase}s_in_month".to_sym
61
61
  define_method(method_name) do
62
- week_split.map { |d| d[i] }.compact
62
+ if WeekOfMonth.configuration.monday_active
63
+ week_split.map { |d| d[i-1] }.compact
64
+ else
65
+ week_split.map { |d| d[i] }.compact
66
+ end
63
67
  end
64
68
  end
65
69
 
@@ -73,7 +77,11 @@ module WeekOfMonth
73
77
  WEEKS_IN_SEQUENCE.each.with_index(-1) do |week_number, j|
74
78
  method_name = "#{week_number.downcase}_#{day_name.downcase}_in_month".to_sym
75
79
  define_method(method_name) do
76
- self.class.new(year, month, week_split.map { |d| d[i] }.compact[j])
80
+ if WeekOfMonth.configuration.monday_active
81
+ self.class.new(year, month, week_split.map { |d| d[i-1] }.compact[j])
82
+ else
83
+ self.class.new(year, month, week_split.map { |d| d[i] }.compact[j])
84
+ end
77
85
  end
78
86
  end
79
87
  end
@@ -1,5 +1,5 @@
1
1
  # @author Sachin Singh
2
2
 
3
3
  module WeekOfMonth
4
- VERSION = '1.2.4'.freeze
4
+ VERSION = '1.2.4.1'.freeze
5
5
  end
@@ -15,6 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.license = 'MIT'
16
16
 
17
17
  s.add_development_dependency 'rake', '>= 12.0.0'
18
- s.add_development_dependency 'bundler', '>= 1.15.0'
19
- s.add_development_dependency 'test-unit', '>= 3.2.3'
18
+ s.add_development_dependency 'bundler', '>= 1.15.4'
19
+ s.add_development_dependency 'test-unit', '>= 3.2.5'
20
20
  end
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
4
+ version: 1.2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sachin87
@@ -39,28 +39,28 @@ dependencies:
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.15.0
42
+ version: 1.15.4
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.15.0
49
+ version: 1.15.4
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: test-unit
52
52
  requirement: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 3.2.3
56
+ version: 3.2.5
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 3.2.3
63
+ version: 3.2.5
64
64
  description: Its gives you week_of_month method on date and time objects, that returns
65
65
  week of the month.
66
66
  email: