week_of_month 1.2.3.4 → 1.2.4

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: 38c961369c785e86656fd70ba102c26d4b58fc19
4
- data.tar.gz: c64a4dfd1818b1dfd347975d146275efaa4c10b1
3
+ metadata.gz: 0d40697431c1fc812225cb4a515a10ead0d8067d
4
+ data.tar.gz: c8db492be402a3e49f56be44243469c53bc8a809
5
5
  SHA512:
6
- metadata.gz: 9dc85ac5f08fc0d86f741930357a00afdb29929977d70709e29d5ebe8def9bd44d98821b4c3ee90d78d9e2c60c64b13493463608e4b3889454a84f8ee3466651
7
- data.tar.gz: 18d86c5d5b0177350db060207e69f9caa7daadd585031e20935ab04cbabc9829915197d7d2abd5319c196b6387e0d2d7fbfe68fc5083f4377f689b1cf42caccc
6
+ metadata.gz: 697711cda4ebd22d70ab622fe2b60d0e586d3bb1f7adce50f2f0b9dbaef8f34f04174a6171f04fbf1ceaaecb46763b944c29bb5459d8d3ec0e4073476174f9b1
7
+ data.tar.gz: be1cc754c4a01803ae4f83fc6fb707f8c8f059156ab9fe194bc0e35d1b36c49bc946ff7920c6aeb38e43ec2f9d729eb77cad10927b3d0d1ec8ee6631cd58fb6a
data/.rvmrc ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 2.4.1@wom" > .rvmrc
9
+ environment_id="ruby-2.4.1@wom"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.27.0 (latest)" # 1.10.1 seems like a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | __rvm_awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"*
27
+ do
28
+ if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]]
29
+ then \. "${__hook}" || true
30
+ fi
31
+ done
32
+ unset __hook
33
+ if (( ${rvm_use_flag:=1} >= 1 )) # display automatically
34
+ then
35
+ if [[ $- == *i* ]] # check for interactive shells
36
+ then printf "%b" "Using: $(tput setaf 2 2>/dev/null)$GEM_HOME$(tput sgr0 2>/dev/null)\n" # show the user the ruby and gemset they are using in green
37
+ else printf "%b" "Using: $GEM_HOME\n" # don't use colors in non-interactive shells
38
+ fi
39
+ fi
40
+ else
41
+ # If the environment file has not yet been created, use the RVM CLI to select.
42
+ rvm --create use "$environment_id" || {
43
+ echo "Failed to create RVM environment '${environment_id}'."
44
+ return 1
45
+ }
46
+ fi
47
+
48
+ # If you use bundler, this might be useful to you:
49
+ # if [[ -s Gemfile ]] && {
50
+ # ! builtin command -v bundle >/dev/null ||
51
+ # builtin command -v bundle | GREP_OPTIONS="" \command \grep $rvm_path/bin/bundle >/dev/null
52
+ # }
53
+ # then
54
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
55
+ # gem install bundler
56
+ # fi
57
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
58
+ # then
59
+ # bundle install | GREP_OPTIONS="" \command \grep -vE '^Using|Your bundle is complete'
60
+ # fi
data/Gemfile CHANGED
@@ -2,13 +2,12 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
-
6
5
  group :development do
7
6
  # Debugging
8
7
  gem 'byebug'
9
8
 
10
9
  # Documentation
11
- gem 'yard' # Documentation generator
12
10
  gem 'redcarpet' # Markdown implementation (for yard)
11
+ gem 'rubocop', require: false
12
+ gem 'yard' # Documentation generator
13
13
  end
14
-
@@ -6,24 +6,44 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ ast (2.3.0)
9
10
  byebug (4.0.5)
10
11
  columnize (= 0.9.0)
11
12
  columnize (0.9.0)
12
- power_assert (0.2.2)
13
- rake (10.4.2)
13
+ parallel (1.11.2)
14
+ parser (2.4.0.0)
15
+ ast (~> 2.2)
16
+ power_assert (0.4.1)
17
+ powerpack (0.1.1)
18
+ rainbow (2.2.2)
19
+ rake
20
+ rake (12.0.0)
14
21
  redcarpet (3.2.3)
15
- test-unit (3.0.8)
22
+ rubocop (0.49.1)
23
+ parallel (~> 1.10)
24
+ parser (>= 2.3.3.1, < 3.0)
25
+ powerpack (~> 0.1)
26
+ rainbow (>= 1.99.1, < 3.0)
27
+ ruby-progressbar (~> 1.7)
28
+ unicode-display_width (~> 1.0, >= 1.0.1)
29
+ ruby-progressbar (1.8.1)
30
+ test-unit (3.2.3)
16
31
  power_assert
32
+ unicode-display_width (1.2.1)
17
33
  yard (0.8.7.6)
18
34
 
19
35
  PLATFORMS
20
36
  ruby
21
37
 
22
38
  DEPENDENCIES
23
- bundler (>= 1.0)
39
+ bundler (>= 1.15.0)
24
40
  byebug
25
- rake (>= 10.1.0)
41
+ rake (>= 12.0.0)
26
42
  redcarpet
27
- test-unit
43
+ rubocop
44
+ test-unit (>= 3.2.3)
28
45
  week_of_month!
29
46
  yard
47
+
48
+ BUNDLED WITH
49
+ 1.15.0
data/README.md CHANGED
@@ -33,8 +33,7 @@ include this line inside your application.rb:
33
33
  ```ruby
34
34
  WeekOfMonth.configuration.monday_active = true
35
35
  ```
36
- This will do all manipulations considering monday as first day of week.
37
-
36
+ This will do all manipulations considering Monday as the first day of a week.
38
37
  ## Usage
39
38
 
40
39
  **Return the days of the month as if they were displayed on a calendar. In this example, the first day of January starts on a Sunday. Note the format is always (year, month, day)**
@@ -67,7 +66,7 @@ Date.new(2012,1,31).week_of_month_in_eng
67
66
  # => "Fifth"
68
67
  ```
69
68
 
70
- **Return true if date lies in first week of month, otherwise false will be returned. Also works with second week and last week.**
69
+ **Return true if date lies in the first week of a month, otherwise false will be returned. Also works with second week and last week.**
71
70
 
72
71
  ```ruby
73
72
  Date.new(2012,1,1).first_week?
@@ -181,7 +180,7 @@ august?, september?, october?, november?, december?, last_day_of_month
181
180
  ## Contributing to Week of month
182
181
 
183
182
  Fork, fix, then send me a pull request,
184
- and most important add yourself to list of authors in gemspec file.
183
+ and most important add yourself to a list of authors in a gemspec file.
185
184
 
186
185
  ## License
187
186
 
data/Rakefile CHANGED
@@ -5,9 +5,9 @@ require 'bundler/gem_tasks'
5
5
 
6
6
  Rake::TestTask.new do |t|
7
7
  t.libs << 'test'
8
- t.test_files = FileList['lib/test/modules/test*.rb']
8
+ t.test_files = FileList['lib/test/modules/date/test*.rb', 'lib/test/modules/time/test*.rb']
9
9
  t.verbose = true
10
10
  end
11
11
 
12
12
  desc 'Run tests'
13
- task :default => :test
13
+ task default: :test
@@ -5,39 +5,38 @@
5
5
 
6
6
  module WeekOfMonth
7
7
  module Constant
8
-
9
8
  # hash containing english words from one to seven
10
9
  WEEK_OF_MONTH_IN_ENG = { 1 => 'First', 2 => 'Second', 3 => 'Third',
11
- 4 => 'Fourth', 5 => 'Fifth', 6 => 'Sixth', 7 => 'Seventh'}
10
+ 4 => 'Fourth', 5 => 'Fifth', 6 => 'Sixth', 7 => 'Seventh' }.freeze
12
11
 
13
12
  # hash containing french words from one to seven
14
13
  WEEK_OF_MONTH_IN_FR = { 1 => 'Premier', 2 => 'Deuxième', 3 => 'Troisième',
15
- 4 => 'Quatrième', 5 => 'Cinquième', 6 => 'Sixième', 7 => 'Septième'}
14
+ 4 => 'Quatrième', 5 => 'Cinquième', 6 => 'Sixième', 7 => 'Septième' }.freeze
16
15
 
17
16
  # hash containing german words from one to seven
18
17
  WEEK_OF_MONTH_IN_GER = { 1 => 'First', 2 => 'Second', 3 => 'Dritten',
19
- 4 => 'Vierte', 5 => 'Fünfte', 6 => 'Sechste', 7 => 'siebte'}
18
+ 4 => 'Vierte', 5 => 'Fünfte', 6 => 'Sechste', 7 => 'siebte' }.freeze
20
19
 
21
20
  # hash containing japanese words from one to seven
22
- WEEK_OF_MONTH_IN_JAP = { 1 => '最初', 2 => '', 3 => 'サード',
23
- 4 => '第4回', 5 => '第五', 6=> 'シックス', 7 => '第7' }
21
+ WEEK_OF_MONTH_IN_JA = { 1 => '第一', 2 => '第二', 3 => '第三',
22
+ 4 => '第四', 5 => '第五', 6 => '第六', 7 => '第七' }.freeze
24
23
 
25
24
  # hash containing month name with days in that month(in non leap year)
26
- MONTH_WITH_DAY = { :january => 31, :february => 28, :march => 31,
27
- :april => 30, :may => 31, :june => 30, :july => 31,
28
- :august => 31, :september => 30, :october => 31,
29
- :november => 30, :december => 31 }
25
+ MONTH_WITH_DAY = { january: 31, february: 28, march: 31,
26
+ april: 30, may: 31, june: 30, july: 31,
27
+ august: 31, september: 30, october: 31,
28
+ november: 30, december: 31 }.freeze
30
29
 
31
30
  # hash containing month names with their sequence
32
- MONTH_WITH_SEQUENCE = { :january => 1, :february => 2, :march => 3,
33
- :april => 4, :may => 5, :june => 6, :july => 7,
34
- :august => 8, :september => 9, :october => 10,
35
- :november => 11, :december => 12 }
31
+ MONTH_WITH_SEQUENCE = { january: 1, february: 2, march: 3,
32
+ april: 4, may: 5, june: 6, july: 7,
33
+ august: 8, september: 9, october: 10,
34
+ november: 11, december: 12 }.freeze
36
35
 
37
36
  # array of ordered days names starting from sunday and ending with saturday.
38
- DAYS_IN_SEQUENCE = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
37
+ DAYS_IN_SEQUENCE = %w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday].freeze
39
38
 
40
39
  # array of ordered days names starting from sunday and ending with saturday.
41
- WEEKS_IN_SEQUENCE = %w(Last First Second Third Fourth Fifth)
40
+ WEEKS_IN_SEQUENCE = %w[Last First Second Third Fourth Fifth].freeze
42
41
  end
43
42
  end
@@ -4,7 +4,6 @@
4
4
  # @author Sachin Singh
5
5
 
6
6
  module WeekOfMonth
7
-
8
7
  attr_accessor :config
9
8
 
10
9
  def initialize(config = Configuration.new)
@@ -21,13 +20,13 @@ module WeekOfMonth
21
20
  # 31]
22
21
  # @return [Array]
23
22
  def days_array
24
- day = self.beginning_of_month.to_date.wday
23
+ day = beginning_of_month.to_date.wday
25
24
  if WeekOfMonth.configuration.monday_active == true
26
25
  day = day.zero? ? 6 : day - 1
27
26
  end
28
27
  array = []
29
28
  array[day] = 1
30
- (2..self.end_of_month.mday).each {|i| array << i }
29
+ (2..end_of_month.mday).each { |i| array << i }
31
30
  array
32
31
  end
33
32
 
@@ -35,7 +34,7 @@ module WeekOfMonth
35
34
  # => 'Thursday'
36
35
  # @return [String]
37
36
  def name_of_week_day
38
- self.class.new(year,month,day).strftime('%A')
37
+ self.class.new(year, month, day).strftime('%A')
39
38
  end
40
39
 
41
40
  # this code generates methods with names like 'upcoming_monday' and 'previous_monday'
@@ -43,28 +42,28 @@ module WeekOfMonth
43
42
  # => #<Date: 2013-01-07 ((2456300j,0s,0n),+0s,2299161j)>
44
43
  # Date.new(2013,1,1).previous_monday
45
44
  # => #<Date: 2012-12-31 ((2456293j,0s,0n),+0s,2299161j)>
46
- { 'upcoming' => '+', 'previous' => '-' }.each_pair do |key,value|
45
+ { 'upcoming' => '+', 'previous' => '-' }.each_pair do |key, value|
47
46
  Date::DAYNAMES.each do |day_name|
48
47
  name = "#{key}_#{day_name.downcase}".to_sym
49
48
  check = "#{day_name.downcase}?".to_sym
50
49
  define_method(name) do
51
- date = eval "self"
50
+ date = eval 'self'
52
51
  if date.send(check)
53
52
  if date.class == Date
54
- date = date.send(value,7)
53
+ date = date.send(value, 7)
55
54
  elsif date.class == Time
56
- date = date.send(value,(60 * 60 * 24 * 7))
55
+ date = date.send(value, (60 * 60 * 24 * 7))
56
+ end
57
+ else
58
+ until date.send(check)
59
+ if date.class == Date
60
+ date = date.send(value, 1)
61
+ elsif date.class == Time
62
+ date = date.send(value, (60 * 60 * 24))
63
+ end
57
64
  end
58
- else
59
- until date.send(check)
60
- if date.class == Date
61
- date = date.send(value,1)
62
- elsif date.class == Time
63
- date = date.send(value,(60 * 60 * 24))
64
- end
65
- end
66
- end
67
- date
65
+ end
66
+ date
68
67
  end
69
68
  end
70
69
  end
@@ -79,37 +78,36 @@ module WeekOfMonth
79
78
  # returns array of all working days of the month
80
79
  # Date.new(2014,12,1).all_working_days_of_month
81
80
  # => [#<Date: 2014-12-31 ((2457023j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-30 ((2457022j,0s,0n),+0s,2299161j)>,
82
- # #<Date: 2014-12-29 ((2457021j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-26 ((2457018j,0s,0n),+0s,2299161j)>,
83
- # #<Date: 2014-12-25 ((2457017j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-24 ((2457016j,0s,0n),+0s,2299161j)>,
84
- # #<Date: 2014-12-23 ((2457015j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-22 ((2457014j,0s,0n),+0s,2299161j)>,
85
- # #<Date: 2014-12-19 ((2457011j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-18 ((2457010j,0s,0n),+0s,2299161j)>,
86
- # #<Date: 2014-12-17 ((2457009j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-16 ((2457008j,0s,0n),+0s,2299161j)>,
87
- # #<Date: 2014-12-15 ((2457007j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-12 ((2457004j,0s,0n),+0s,2299161j)>,
88
- # #<Date: 2014-12-11 ((2457003j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-10 ((2457002j,0s,0n),+0s,2299161j)>,
89
- # #<Date: 2014-12-09 ((2457001j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-08 ((2457000j,0s,0n),+0s,2299161j)>,
90
- # #<Date: 2014-12-05 ((2456997j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-04 ((2456996j,0s,0n),+0s,2299161j)>,
91
- # #<Date: 2014-12-03 ((2456995j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-02 ((2456994j,0s,0n),+0s,2299161j)>,
92
- # #<Date: 2014-12-01 ((2456993j,0s,0n),+0s,2299161j)>]
81
+ # #<Date: 2014-12-29 ((2457021j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-26 ((2457018j,0s,0n),+0s,2299161j)>,
82
+ # #<Date: 2014-12-25 ((2457017j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-24 ((2457016j,0s,0n),+0s,2299161j)>,
83
+ # #<Date: 2014-12-23 ((2457015j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-22 ((2457014j,0s,0n),+0s,2299161j)>,
84
+ # #<Date: 2014-12-19 ((2457011j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-18 ((2457010j,0s,0n),+0s,2299161j)>,
85
+ # #<Date: 2014-12-17 ((2457009j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-16 ((2457008j,0s,0n),+0s,2299161j)>,
86
+ # #<Date: 2014-12-15 ((2457007j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-12 ((2457004j,0s,0n),+0s,2299161j)>,
87
+ # #<Date: 2014-12-11 ((2457003j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-10 ((2457002j,0s,0n),+0s,2299161j)>,
88
+ # #<Date: 2014-12-09 ((2457001j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-08 ((2457000j,0s,0n),+0s,2299161j)>,
89
+ # #<Date: 2014-12-05 ((2456997j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-04 ((2456996j,0s,0n),+0s,2299161j)>,
90
+ # #<Date: 2014-12-03 ((2456995j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-02 ((2456994j,0s,0n),+0s,2299161j)>,
91
+ # #<Date: 2014-12-01 ((2456993j,0s,0n),+0s,2299161j)>]
93
92
  def all_working_days_of_month
94
- self.end_of_month.downto(beginning_of_month).select{|day| day.working_day? }
93
+ end_of_month.downto(beginning_of_month).select(&:working_day?)
95
94
  end
96
95
 
97
96
  # returns array of all non working days of the month
98
97
  # Date.new(2014,12,1).all_non_week_days_of_month
99
98
  # => [#<Date: 2014-12-28 ((2457020j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-27 ((2457019j,0s,0n),+0s,2299161j)>,
100
- # #<Date: 2014-12-21 ((2457013j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-20 ((2457012j,0s,0n),+0s,2299161j)>,
101
- # #<Date: 2014-12-14 ((2457006j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-13 ((2457005j,0s,0n),+0s,2299161j)>,
102
- # #<Date: 2014-12-07 ((2456999j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-06 ((2456998j,0s,0n),+0s,2299161j)>]
99
+ # #<Date: 2014-12-21 ((2457013j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-20 ((2457012j,0s,0n),+0s,2299161j)>,
100
+ # #<Date: 2014-12-14 ((2457006j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-13 ((2457005j,0s,0n),+0s,2299161j)>,
101
+ # #<Date: 2014-12-07 ((2456999j,0s,0n),+0s,2299161j)>, #<Date: 2014-12-06 ((2456998j,0s,0n),+0s,2299161j)>]
103
102
  def all_non_week_days_of_month
104
- self.end_of_month.downto(beginning_of_month).select{|day| day.week_end? }
103
+ end_of_month.downto(beginning_of_month).select(&:week_end?)
105
104
  end
106
105
 
107
- # gives first working/business day of the month
106
+ # returns first working/business day of the month
108
107
  # Date.new(2014,12,1).first_working_day_of_the_month
109
108
  # => #<Date: 2014-12-01 ((2456993j,0s,0n),+0s,2299161j)>
110
109
  def first_working_day_of_the_month
111
- self.beginning_of_month.upto(end_of_month).find{|day| day.working_day? }
110
+ beginning_of_month.upto(end_of_month).find(&:working_day?)
112
111
  end
113
-
114
112
  end
115
113
  end
@@ -1,10 +1,9 @@
1
- # @author Sachion Singh
1
+ # @author Sachion Singh
2
2
 
3
3
  RUBY_VERSION < '1.9' ? require('modules/constant') : require_relative('constant')
4
4
 
5
5
  module WeekOfMonth
6
6
  module Month
7
-
8
7
  include WeekOfMonth::Constant
9
8
 
10
9
  # this code generates method named like january?..december?
@@ -15,7 +14,7 @@ module WeekOfMonth
15
14
  MONTH_WITH_SEQUENCE[month_name] == month
16
15
  end
17
16
  end
18
-
17
+
19
18
  # returns day of last day of month for a given date.
20
19
  # Date.new(2012,11,1).last_day_of_month
21
20
  # => 30
@@ -33,23 +32,23 @@ module WeekOfMonth
33
32
  # => #<Date: 2012-11-30 ((2456262j,0s,0n),+0s,2299161j)>
34
33
  # @return [Date]
35
34
  def end_of_month
36
- self.class.new(year,month,last_day_of_month)
35
+ self.class.new(year, month, last_day_of_month)
37
36
  end
38
37
 
39
- # returns date of first day of month for a given date.
38
+ # returns date of first day of month for a given date.
40
39
  # Date.new(2012,11,1).beginning_of_month
41
40
  # => #<Date: 2012-11-01 ((2456233j,0s,0n),+0s,2299161j)>
42
41
  # @return [Date]
43
42
  def beginning_of_month
44
- self.class.new(year,month,1)
43
+ self.class.new(year, month, 1)
45
44
  end
46
45
 
47
- # returns name of month for a given date.
46
+ # returns name of month for a given date.
48
47
  # Date.new(2012,11,1).name_of_month
49
48
  # => "November"
50
49
  # @return [String]
51
50
  def name_of_month
52
- self.class.new(year,month,day).strftime('%B')
51
+ self.class.new(year, month, day).strftime('%B')
53
52
  end
54
53
 
55
54
  # this code generates method named like 'all_mondays_in_month',
@@ -60,12 +59,12 @@ module WeekOfMonth
60
59
  DAYS_IN_SEQUENCE.each_with_index do |day_name, i|
61
60
  method_name = "all_#{day_name.downcase}s_in_month".to_sym
62
61
  define_method(method_name) do
63
- week_split.map{|d| d[i] }.compact
62
+ week_split.map { |d| d[i] }.compact
64
63
  end
65
64
  end
66
-
65
+
67
66
  # this code generates method named like 'first_monday_in_month',
68
- # 'second_tuesday_in_month', 'last_friday_in_month' etc. for
67
+ # 'second_tuesday_in_month', 'last_friday_in_month' etc. for
69
68
  # first, second, third, fourth and last seven days of week
70
69
  # Date.new(2014,11).third_saturday_in_month
71
70
  # => #<Date: 2014-11-15>
@@ -74,9 +73,9 @@ module WeekOfMonth
74
73
  WEEKS_IN_SEQUENCE.each.with_index(-1) do |week_number, j|
75
74
  method_name = "#{week_number.downcase}_#{day_name.downcase}_in_month".to_sym
76
75
  define_method(method_name) do
77
- self.class.new(year, month, week_split.map{|d| d[i] }.compact[j])
76
+ self.class.new(year, month, week_split.map { |d| d[i] }.compact[j])
78
77
  end
79
78
  end
80
79
  end
81
80
  end
82
- end
81
+ end
@@ -1,5 +1,5 @@
1
1
  # @author Sachin Singh
2
2
 
3
3
  module WeekOfMonth
4
- VERSION = '1.2.3.4'
4
+ VERSION = '1.2.4'.freeze
5
5
  end