week_of_month 1.2.3.2 → 1.2.3.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: bb763a374f81af6d9930c901028abc73b85fdc17
4
- data.tar.gz: 006949252e68ebb482b07254d031e5366671b264
3
+ metadata.gz: 38c961369c785e86656fd70ba102c26d4b58fc19
4
+ data.tar.gz: c64a4dfd1818b1dfd347975d146275efaa4c10b1
5
5
  SHA512:
6
- metadata.gz: 695d2c55e137bc75e04f343cedf771569dc57ceda2112e7b20e48b7c399f3adf2bfea0d0949bcbe05d52d1d3c51e2951a6776f9c84f6f97c3084c8cf8691f0c9
7
- data.tar.gz: a6a127b55d61f32cf2ccb83e7d6e12720479de5ece65e460a1ca8fba9545bab36183be2fac724d76ab61cc8499988401b5fabceae59f85a4795cbb93994c1a09
6
+ metadata.gz: 9dc85ac5f08fc0d86f741930357a00afdb29929977d70709e29d5ebe8def9bd44d98821b4c3ee90d78d9e2c60c64b13493463608e4b3889454a84f8ee3466651
7
+ data.tar.gz: 18d86c5d5b0177350db060207e69f9caa7daadd585031e20935ab04cbabc9829915197d7d2abd5319c196b6387e0d2d7fbfe68fc5083f4377f689b1cf42caccc
data/Gemfile CHANGED
@@ -2,3 +2,13 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+
6
+ group :development do
7
+ # Debugging
8
+ gem 'byebug'
9
+
10
+ # Documentation
11
+ gem 'yard' # Documentation generator
12
+ gem 'redcarpet' # Markdown implementation (for yard)
13
+ end
14
+
@@ -1,17 +1,29 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- week_of_month (1.2.3.2)
4
+ week_of_month (1.2.3.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- rake (10.1.0)
9
+ byebug (4.0.5)
10
+ columnize (= 0.9.0)
11
+ columnize (0.9.0)
12
+ power_assert (0.2.2)
13
+ rake (10.4.2)
14
+ redcarpet (3.2.3)
15
+ test-unit (3.0.8)
16
+ power_assert
17
+ yard (0.8.7.6)
10
18
 
11
19
  PLATFORMS
12
20
  ruby
13
21
 
14
22
  DEPENDENCIES
15
23
  bundler (>= 1.0)
24
+ byebug
16
25
  rake (>= 10.1.0)
26
+ redcarpet
27
+ test-unit
17
28
  week_of_month!
29
+ yard
data/README.md CHANGED
@@ -6,29 +6,34 @@
6
6
 
7
7
  [gem]: http://badge.fury.io/rb/week_of_month
8
8
  [climate]: https://codeclimate.com/github/sachin87/week-of-month
9
- [license]: http://opensource.org/licenses/MIT
9
+ [license]: http://opensource.org/licenses/MIT
10
10
 
11
- Week of month is a gem which gives you access to methods for the Date and Time class objects. Among accurately displaying the days of a week in the form of a calendar arrangement, this gem will also provide you with tools for identifying which week of the month a particular date lies.
11
+ Week of month is a gem which extends Date and Time class with useful methods. Among accurately displaying the days of a week in the form of a calendar arrangement, this gem will also provide you with tools for identifying which week of the month a particular date lies.
12
12
 
13
13
  ## Getting Started
14
14
 
15
15
  Week of month is released as a Ruby Gem. The gem is to be installed within a Ruby
16
- or Rails application. To install, simply add the following to your Gemfile:
16
+ on Rails application. To install, simply add the following to your Gemfile:
17
17
 
18
18
  ```ruby
19
19
  gem 'week_of_month'
20
20
  ```
21
21
 
22
- Run bundle install and don't forget to restart your server after you install a new gem.
22
+ Run bundle install and don't forget to restart your server after it.
23
23
 
24
- You can also install this gem from the command line as:
24
+ You can also install this gem from the command line as:
25
25
 
26
26
  ```ruby
27
27
  gem install 'week_of_month'
28
28
  ```
29
- ## Assumption
29
+ ## New! Configure week start day!
30
30
 
31
- Sunday is the first day of the week.
31
+ include this line inside your application.rb:
32
+
33
+ ```ruby
34
+ WeekOfMonth.configuration.monday_active = true
35
+ ```
36
+ This will do all manipulations considering monday as first day of week.
32
37
 
33
38
  ## Usage
34
39
 
@@ -39,39 +44,39 @@ Date.new(2012,1,1).week_split
39
44
 
40
45
  =begin
41
46
  [[1, 2, 3, 4, 5, 6, 7],
42
- [8, 9, 10, 11, 12, 13, 14],
43
- [15, 16, 17, 18, 19, 20, 21],
44
- [22, 23, 24, 25, 26, 27, 28],
45
- [29, 30, 31]]
47
+ [8, 9, 10, 11, 12, 13, 14],
48
+ [15, 16, 17, 18, 19, 20, 21],
49
+ [22, 23, 24, 25, 26, 27, 28],
50
+ [29, 30, 31]]
46
51
  =end
47
52
  ```
48
53
  **Return the total number of weeks in a month.**
49
54
 
50
55
  ```ruby
51
56
  Date.new(2012,1,31).total_weeks
52
- # => 5
57
+ # => 5
53
58
  ```
54
59
 
55
60
  **Return what number week in the month a specific date lies. Can also return the number in english.**
56
61
 
57
62
  ```ruby
58
- Date.new(2012,1,31).week_of_month
63
+ Date.new(2012,1,31).week_of_month
59
64
  # => 5
60
65
 
61
66
  Date.new(2012,1,31).week_of_month_in_eng
62
- # => "Fifth"
67
+ # => "Fifth"
63
68
  ```
64
69
 
65
70
  **Return true if date lies in first week of month, otherwise false will be returned. Also works with second week and last week.**
66
71
 
67
72
  ```ruby
68
73
  Date.new(2012,1,1).first_week?
69
- # => true
74
+ # => true
70
75
 
71
76
  Date.new(2012,1,9).second_week?
72
- # => true
77
+ # => true
73
78
 
74
- Date.new(2012,1,31).last_week?
79
+ Date.new(2012,1,31).last_week?
75
80
  # => true
76
81
  ```
77
82
 
@@ -86,12 +91,12 @@ Date.new(2012,1,1).name_of_month
86
91
 
87
92
  ```ruby
88
93
  Date.new(2012,1,1).january?
89
- # => true
94
+ # => true
90
95
 
91
96
  Date.new(2012,1,9).august?
92
- # => false
97
+ # => false
93
98
 
94
- Date.new(2012,12,25).december?
99
+ Date.new(2012,12,25).december?
95
100
  # => true
96
101
  ```
97
102
 
@@ -99,17 +104,17 @@ Date.new(2012,12,25).december?
99
104
 
100
105
  ```ruby
101
106
  Date.new(2012,1,1).last_day_of_month
102
- # => 31
107
+ # => 31
103
108
 
104
109
  Date.new(2012,2,9).last_day_of_month
105
- # => 29
110
+ # => 29
106
111
  ```
107
112
 
108
113
  **Return the dates for which the day of the method falls (works for all days).**
109
114
 
110
115
  ```ruby
111
116
  Date.new(2012,1,1).all_mondays_in_month
112
- # => [2, 9, 16, 23, 30]
117
+ # => [2, 9, 16, 23, 30]
113
118
  ```
114
119
 
115
120
  **Return the day of the week for the specified date.**
@@ -175,7 +180,8 @@ august?, september?, october?, november?, december?, last_day_of_month
175
180
 
176
181
  ## Contributing to Week of month
177
182
 
178
- Fork, fix, then send me a pull request.
183
+ Fork, fix, then send me a pull request,
184
+ and most important add yourself to list of authors in gemspec file.
179
185
 
180
186
  ## License
181
187
 
data/Rakefile CHANGED
@@ -1,11 +1,13 @@
1
+ # @author Sachin Singh
2
+
1
3
  require 'rake/testtask'
2
4
  require 'bundler/gem_tasks'
3
5
 
4
6
  Rake::TestTask.new do |t|
5
- t.libs << "test"
7
+ t.libs << 'test'
6
8
  t.test_files = FileList['lib/test/modules/test*.rb']
7
9
  t.verbose = true
8
10
  end
9
11
 
10
- desc "Run tests"
12
+ desc 'Run tests'
11
13
  task :default => :test
@@ -0,0 +1,26 @@
1
+ module WeekOfMonth
2
+ class Configuration
3
+ attr_accessor \
4
+ :monday_active
5
+
6
+ def initialize
7
+ @monday_active = false
8
+ end
9
+
10
+ def monday_active?
11
+ @monday_active
12
+ end
13
+ end
14
+
15
+ def self.configuration
16
+ @configuration ||= Configuration.new
17
+ end
18
+
19
+ def self.configuration=(config)
20
+ @configuration = config
21
+ end
22
+
23
+ def self.configure
24
+ yield configuration
25
+ end
26
+ end
@@ -5,37 +5,39 @@
5
5
 
6
6
  module WeekOfMonth
7
7
  module Constant
8
-
8
+
9
9
  # hash containing english words from one to seven
10
10
  WEEK_OF_MONTH_IN_ENG = { 1 => 'First', 2 => 'Second', 3 => 'Third',
11
11
  4 => 'Fourth', 5 => 'Fifth', 6 => 'Sixth', 7 => 'Seventh'}
12
12
 
13
13
  # hash containing french words from one to seven
14
- WEEK_OF_MONTH_IN_FR = { 1 => 'First', 2 => 'Second', 3 => 'Third',
15
- 4 => 'Quatrième', 5 => 'Cinquième', 6 => 'sixième', 7 => 'septième'}
14
+ 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'}
16
16
 
17
17
  # hash containing german words from one to seven
18
18
  WEEK_OF_MONTH_IN_GER = { 1 => 'First', 2 => 'Second', 3 => 'Dritten',
19
19
  4 => 'Vierte', 5 => 'Fünfte', 6 => 'Sechste', 7 => 'siebte'}
20
20
 
21
- # hash containing japneese words from one to seven
21
+ # hash containing japanese words from one to seven
22
22
  WEEK_OF_MONTH_IN_JAP = { 1 => '最初', 2 => '秒', 3 => 'サード',
23
23
  4 => '第4回', 5 => '第五', 6=> 'シックス', 7 => '第7' }
24
-
25
- # hash containing month name with days in that month(in non leap yaer)
24
+
25
+ # hash containing month name with days in that month(in non leap year)
26
26
  MONTH_WITH_DAY = { :january => 31, :february => 28, :march => 31,
27
27
  :april => 30, :may => 31, :june => 30, :july => 31,
28
28
  :august => 31, :september => 30, :october => 31,
29
29
  :november => 30, :december => 31 }
30
30
 
31
- # hash containing month names with their sequence
31
+ # hash containing month names with their sequence
32
32
  MONTH_WITH_SEQUENCE = { :january => 1, :february => 2, :march => 3,
33
33
  :april => 4, :may => 5, :june => 6, :july => 7,
34
34
  :august => 8, :september => 9, :october => 10,
35
35
  :november => 11, :december => 12 }
36
-
37
- # array of days names ordered starting with sunday and ending with saturday.
38
- DAYS_IN_SEQUENCE = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
39
- "Saturday"]
36
+
37
+ # array of ordered days names starting from sunday and ending with saturday.
38
+ DAYS_IN_SEQUENCE = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
39
+
40
+ # array of ordered days names starting from sunday and ending with saturday.
41
+ WEEKS_IN_SEQUENCE = %w(Last First Second Third Fourth Fifth)
40
42
  end
41
43
  end
@@ -4,8 +4,14 @@
4
4
  # @author Sachin Singh
5
5
 
6
6
  module WeekOfMonth
7
- module Day
8
7
 
8
+ attr_accessor :config
9
+
10
+ def initialize(config = Configuration.new)
11
+ @config = config
12
+ end
13
+
14
+ module Day
9
15
  # gives array of days in month
10
16
  # Date.new(2012,1,1).days_array
11
17
  # => [ 1, 2, 3, 4, 5, 6, 7, 8, 9,
@@ -16,6 +22,9 @@ module WeekOfMonth
16
22
  # @return [Array]
17
23
  def days_array
18
24
  day = self.beginning_of_month.to_date.wday
25
+ if WeekOfMonth.configuration.monday_active == true
26
+ day = day.zero? ? 6 : day - 1
27
+ end
19
28
  array = []
20
29
  array[day] = 1
21
30
  (2..self.end_of_month.mday).each {|i| array << i }
@@ -28,8 +37,8 @@ module WeekOfMonth
28
37
  def name_of_week_day
29
38
  self.class.new(year,month,day).strftime('%A')
30
39
  end
31
-
32
- # this code generates method names like 'upcoming_monday' and 'previous_monday'
40
+
41
+ # this code generates methods with names like 'upcoming_monday' and 'previous_monday'
33
42
  # Date.new(2013,1,1).upcoming_monday
34
43
  # => #<Date: 2013-01-07 ((2456300j,0s,0n),+0s,2299161j)>
35
44
  # Date.new(2013,1,1).previous_monday
@@ -42,14 +51,14 @@ module WeekOfMonth
42
51
  date = eval "self"
43
52
  if date.send(check)
44
53
  if date.class == Date
45
- date = date.send(value,7)
54
+ date = date.send(value,7)
46
55
  elsif date.class == Time
47
56
  date = date.send(value,(60 * 60 * 24 * 7))
48
57
  end
49
58
  else
50
59
  until date.send(check)
51
60
  if date.class == Date
52
- date = date.send(value,1)
61
+ date = date.send(value,1)
53
62
  elsif date.class == Time
54
63
  date = date.send(value,(60 * 60 * 24))
55
64
  end
@@ -59,6 +68,48 @@ module WeekOfMonth
59
68
  end
60
69
  end
61
70
  end
62
-
71
+
72
+ # gives last working/business day of the month
73
+ # Date.new(2014,12,1).last_business_day_of_month
74
+ # => #<Date: 2014-12-31 ((2457023j,0s,0n),+0s,2299161j)>
75
+ def last_business_day_of_month
76
+ all_working_days_of_month.first
77
+ end
78
+
79
+ # returns array of all working days of the month
80
+ # Date.new(2014,12,1).all_working_days_of_month
81
+ # => [#<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)>]
93
+ def all_working_days_of_month
94
+ self.end_of_month.downto(beginning_of_month).select{|day| day.working_day? }
95
+ end
96
+
97
+ # returns array of all non working days of the month
98
+ # Date.new(2014,12,1).all_non_week_days_of_month
99
+ # => [#<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)>]
103
+ def all_non_week_days_of_month
104
+ self.end_of_month.downto(beginning_of_month).select{|day| day.week_end? }
105
+ end
106
+
107
+ # gives first working/business day of the month
108
+ # Date.new(2014,12,1).first_working_day_of_the_month
109
+ # => #<Date: 2014-12-01 ((2456993j,0s,0n),+0s,2299161j)>
110
+ def first_working_day_of_the_month
111
+ self.beginning_of_month.upto(end_of_month).find{|day| day.working_day? }
112
+ end
113
+
63
114
  end
64
115
  end
@@ -64,5 +64,19 @@ module WeekOfMonth
64
64
  end
65
65
  end
66
66
 
67
+ # this code generates method named like 'first_monday_in_month',
68
+ # 'second_tuesday_in_month', 'last_friday_in_month' etc. for
69
+ # first, second, third, fourth and last seven days of week
70
+ # Date.new(2014,11).third_saturday_in_month
71
+ # => #<Date: 2014-11-15>
72
+ # @return [Date]
73
+ DAYS_IN_SEQUENCE.each_with_index do |day_name, i|
74
+ WEEKS_IN_SEQUENCE.each.with_index(-1) do |week_number, j|
75
+ method_name = "#{week_number.downcase}_#{day_name.downcase}_in_month".to_sym
76
+ define_method(method_name) do
77
+ self.class.new(year, month, week_split.map{|d| d[i] }.compact[j])
78
+ end
79
+ end
80
+ end
67
81
  end
68
82
  end
@@ -1,5 +1,5 @@
1
1
  # @author Sachin Singh
2
2
 
3
3
  module WeekOfMonth
4
- VERSION = '1.2.3.2'
4
+ VERSION = '1.2.3.4'
5
5
  end
@@ -1,4 +1,4 @@
1
- # @author Sachion Singh
1
+ # @author Sachion Singh
2
2
 
3
3
  RUBY_VERSION < '1.9' ? require('modules/constant') : require_relative('constant')
4
4
 
@@ -40,7 +40,7 @@ module WeekOfMonth
40
40
  week_of_month
41
41
  end
42
42
  end
43
-
43
+
44
44
  # checks whether the given day lies in first week of month
45
45
  # Date.new(2012,11,1).first_week?
46
46
  # => true
@@ -48,7 +48,7 @@ module WeekOfMonth
48
48
  def first_week?
49
49
  week_split[0].include?((self.day))
50
50
  end
51
-
51
+
52
52
  # checks whether the given day lies in second week of month
53
53
  # Date.new(2012,11,8).second_week?
54
54
  # => true
@@ -91,13 +91,21 @@ module WeekOfMonth
91
91
 
92
92
  # returns week split of the month for the given date
93
93
  # example-
94
- # Date.new(2012,1,1).week_split
94
+ # Optional argument to change first week day to Monday
95
+ # Date.new(2012,1,1).week_split -> Sunday is first week day
95
96
  # => [[1, 2, 3, 4, 5, 6, 7],
96
- # [8, 9, 10, 11, 12, 13, 14],
97
- # [15, 16, 17, 18, 19, 20, 21],
98
- # [22, 23, 24, 25, 26, 27, 28],
97
+ # [8, 9, 10, 11, 12, 13, 14],
98
+ # [15, 16, 17, 18, 19, 20, 21],
99
+ # [22, 23, 24, 25, 26, 27, 28],
99
100
  # [29, 30, 31]
100
- # @return [Array]
101
+ # Date.new(2012,1,1).week_split(true) -> Monday is first week day
102
+ # => [[nil,nil,nil,nil,nil,nil,1],
103
+ # [2, 3, 4, 5, 6, 7, 8],
104
+ # [9, 10, 11, 12, 13, 14, 15],
105
+ # [16, 17, 18, 19, 20, 21, 22],
106
+ # [23, 24, 25, 26, 27, 28, 29],
107
+ # [30, 31]
108
+ # @return [Array]
101
109
  def week_split
102
110
  days_array.each_slice(7).to_a
103
111
  end
@@ -107,23 +115,23 @@ module WeekOfMonth
107
115
  # => 'Third'
108
116
  # Date.new(2012,11,30).week_of_month_in_fr
109
117
  # => "Cinquième"
110
- # @return [String]
118
+ # @return [String]
111
119
  constants.select{|x| x.to_s.match("WEEK_OF_MONTH_IN_")}.each do |const|
112
120
  define_method(const.to_s.downcase) do
113
121
  eval "#{const.to_s}[week_of_month]"
114
122
  end
115
123
  end
116
-
124
+
117
125
  # it returns days past in the week
118
126
  # Date.new(2012,11,15).days_past_in_week
119
127
  # => 4
120
128
  # Time.new(2012,11,30).days_past_in_week
121
129
  # => 5
122
- # @return [Fixnum]
130
+ # @return [Fixnum]
123
131
  def days_past_in_week
124
132
  self.to_date.cwday
125
133
  end
126
-
134
+
127
135
  # it returns days left in the week
128
136
  # Date.new(2012,11,15).days_left_in_week
129
137
  # => 3
@@ -133,23 +141,23 @@ module WeekOfMonth
133
141
  def days_left_in_week
134
142
  7 - days_past_in_week
135
143
  end
136
-
144
+
137
145
  # it returns date of the first day(sunday) of the week
138
146
  # Date.new(2012,11,15).beginning_of_week
139
147
  # => #<Date: 2012-11-12 ((2456244j,0s,0n),+0s,2299161j)>
140
148
  # Time.new(2012,11,30).beginning_of_week
141
149
  # => 2012-11-29 23:59:55 +0530
142
- # @return [Date || Time]
150
+ # @return [Date || Time]
143
151
  def beginning_of_week
144
152
  self.class.new(year,month,current_week.detect {|i| !i.nil?})
145
153
  end
146
-
154
+
147
155
  # it returns date of the last day(saturday) of the week
148
156
  # Date.new(2012,11,15).end_of_week
149
157
  # => #<Date: 2012-11-19 ((2456251j,0s,0n),+0s,2299161j)>
150
158
  # Time.new(2012,11,30).end_of_week
151
159
  # => 2012-11-30 00:00:02 +0530
152
- # @return [Date || Time]
160
+ # @return [Date || Time]
153
161
  def end_of_week
154
162
  if current_week.index(self.day) == 6
155
163
  self.class.new(year,month,current_week.last)
@@ -161,42 +169,42 @@ module WeekOfMonth
161
169
  end
162
170
  end
163
171
  end
164
-
172
+
165
173
  # it returns date of the next week day.
166
174
  # Date.new(2012,11,15).next_week
167
175
  # => #<Date: 2012-11-22 ((2456254j,0s,0n),+0s,2299161j)>
168
176
  # Time.new(2012,11,30).next_week
169
177
  # => 2012-11-30 00:00:07 +0530
170
- # @return [Date || Time]
178
+ # @return [Date || Time]
171
179
  def next_week
172
180
  if self.class == Date
173
- self + 7
181
+ self + 7
174
182
  elsif self.class == Time
175
183
  self + (60 * 60 * 24 * 7)
176
184
  end
177
185
  end
178
-
186
+
179
187
  # it returns date of the previous week day.
180
188
  # Date.new(2012,11,15).previous_week
181
189
  # => #<Date: 2012-11-08 ((2456240j,0s,0n),+0s,2299161j)>
182
190
  # Time.new(2012,11,30).previous_week
183
191
  # => 2012-11-29 23:59:53 +0530
184
- # @return [Date || Time]
192
+ # @return [Date || Time]
185
193
  def previous_week
186
194
  if self.class == Date
187
- self - 7
195
+ self - 7
188
196
  elsif self.class == Time
189
197
  self - (60 * 60 * 24 * 7)
190
198
  end
191
199
  end
192
-
200
+
193
201
  # it returns array of days in current week.
194
202
  # Date.new(2013,1,13).current_week
195
203
  # => [7, 8, 9, 10, 11, 12, 13]
196
- # @return [Array]
204
+ # @return [Array]
197
205
  def current_week
198
206
  week_split.select{|c| c.include?((self.day))}.flatten
199
207
  end
200
-
208
+
201
209
  end
202
210
  end
@@ -6,61 +6,60 @@ RUBY_VERSION < '1.9' ? require('lib/week_of_month') : require_relative('../../we
6
6
 
7
7
 
8
8
  class TestConstant < Test::Unit::TestCase
9
-
9
+
10
10
  def test_constants_present?
11
11
  [Date,Time].each do |klass|
12
12
  assert klass::WEEK_OF_MONTH_IN_ENG
13
-
13
+
14
14
  assert klass::WEEK_OF_MONTH_IN_GER
15
-
15
+
16
16
  assert klass::WEEK_OF_MONTH_IN_FR
17
-
17
+
18
18
  assert klass::WEEK_OF_MONTH_IN_JAP
19
-
19
+
20
20
  assert klass::MONTH_WITH_DAY
21
-
21
+
22
22
  assert klass::MONTH_WITH_SEQUENCE
23
23
 
24
24
  assert klass::DAYS_IN_SEQUENCE
25
25
  end
26
26
  end
27
-
27
+
28
28
  def test_constants_value
29
29
  [Date,Time].each do |klass|
30
30
  assert_equal({ 1 => 'First', 2 => 'Second',
31
31
  3 => 'Third', 4 => 'Fourth',
32
32
  5 => 'Fifth', 6 => 'Sixth',
33
33
  7 =>"Seventh" }, klass::WEEK_OF_MONTH_IN_ENG)
34
-
35
- assert_equal({ 1 => 'First', 2 => 'Second',
36
- 3 => 'Third', 4 => 'Quatrième',
37
- 5 => 'Cinquième', 6 => 'sixième',
38
- 7 => "septième" }, klass::WEEK_OF_MONTH_IN_FR)
39
-
34
+
35
+ assert_equal({ 1 => 'Premier', 2 => 'Deuxième',
36
+ 3 => 'Troisième', 4 => 'Quatrième',
37
+ 5 => 'Cinquième', 6 => 'Sixième',
38
+ 7 => "Septième" }, klass::WEEK_OF_MONTH_IN_FR)
39
+
40
40
  assert_equal({ 1 => 'First', 2 => 'Second',
41
41
  3 => 'Dritten', 4 => 'Vierte',
42
42
  5 => 'Fünfte', 6 => 'Sechste',
43
43
  7 => "siebte" }, klass::WEEK_OF_MONTH_IN_GER)
44
-
44
+
45
45
  assert_equal({ 1=>'最初', 2 =>'秒',
46
46
  3 =>'サード', 4=> '第4回',
47
47
  5 =>'第五', 6=> 'シックス' ,
48
48
  7 => "第7" } , klass::WEEK_OF_MONTH_IN_JAP)
49
-
50
- assert_equal({ :january => 1, :february => 2, :march => 3,
51
- :april => 4, :may => 5, :june => 6, :july => 7,
52
- :august => 8, :september => 9, :october => 10,
49
+
50
+ assert_equal({ :january => 1, :february => 2, :march => 3,
51
+ :april => 4, :may => 5, :june => 6, :july => 7,
52
+ :august => 8, :september => 9, :october => 10,
53
53
  :november => 11, :december => 12 }, klass::MONTH_WITH_SEQUENCE)
54
-
55
- assert_equal({ :january => 31, :february => 28, :march => 31,
56
- :april => 30, :may => 31, :june => 30, :july => 31,
57
- :august => 31, :september => 30, :october => 31,
54
+
55
+ assert_equal({ :january => 31, :february => 28, :march => 31,
56
+ :april => 30, :may => 31, :june => 30, :july => 31,
57
+ :august => 31, :september => 30, :october => 31,
58
58
  :november => 30, :december => 31 }, klass::MONTH_WITH_DAY)
59
-
60
- assert_equal(["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
61
- "Friday", "Saturday"], klass::DAYS_IN_SEQUENCE)
59
+
60
+ assert_equal(%w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday), klass::DAYS_IN_SEQUENCE)
62
61
  end
63
62
  end
64
-
63
+
65
64
  end
66
-
65
+
@@ -28,7 +28,32 @@ class TestDay < Test::Unit::TestCase
28
28
  end
29
29
  end
30
30
 
31
+ def test_days_array_monday
32
+ WeekOfMonth.configuration.monday_active = true
33
+ [Date,Time].each do |klass|
34
+ object = klass.new(2014,11,3)
35
+
36
+ days_array_for_november = [nil, nil, nil, nil, nil, 1, 2,
37
+ 3, 4, 5, 6, 7, 8, 9, 10, 11,
38
+ 12, 13, 14, 15, 16, 17, 18,
39
+ 19, 20, 21, 22, 23, 24, 25, 26,
40
+ 27, 28, 29, 30]
41
+ assert_kind_of Array,object.days_array
42
+ assert_equal days_array_for_november, object.days_array
43
+
44
+ object = klass.new(2014,12,1)
45
+ days_array_for_december = [ 1, 2, 3, 4, 5, 6, 7,
46
+ 8, 9, 10, 11, 12, 13,
47
+ 14, 15, 16, 17, 18, 19,
48
+ 20, 21, 22, 23, 24, 25,
49
+ 26, 27, 28, 29, 30, 31]
50
+ assert_kind_of Array,object.days_array
51
+ assert_equal days_array_for_december, object.days_array
52
+ end
53
+ end
54
+
31
55
  def test_name_of_week_day
56
+ WeekOfMonth.configuration.monday_active = false
32
57
  [Date,Time].each do |klass|
33
58
  assert_equal "Saturday", klass.new(2012,12,1).name_of_week_day
34
59
  assert_equal "Sunday", klass.new(2012,12,2).name_of_week_day
@@ -126,5 +151,34 @@ class TestDay < Test::Unit::TestCase
126
151
  assert_equal klass.new(2012,12,30), klass.new(2013,1,1).previous_sunday
127
152
  end
128
153
  end
154
+
155
+ def test_all_working_days_of_month
156
+ [Date].each do |klass|
157
+ assert_equal [
158
+ klass.new(2013,4,30), klass.new(2013,4,29),
159
+ klass.new(2013,4,26), klass.new(2013,4,25), klass.new(2013,4,24), klass.new(2013,4,23), klass.new(2013,4,22),
160
+ klass.new(2013,4,19), klass.new(2013,4,18), klass.new(2013,4,17), klass.new(2013,4,16), klass.new(2013,4,15),
161
+ klass.new(2013,4,12), klass.new(2013,4,11), klass.new(2013,4,10), klass.new(2013,4,9), klass.new(2013,4,8),
162
+ klass.new(2013,4,5), klass.new(2013,4,4), klass.new(2013,4,3), klass.new(2013,4,2), klass.new(2013,4,1),
163
+ ], klass.new(2013,4,1).all_working_days_of_month
164
+ end
165
+ end
166
+
167
+ def test_all_non_week_days_of_month
168
+ [Date].each do |klass|
169
+ assert_equal [
170
+ klass.new(2013,4,28), klass.new(2013,4,27),
171
+ klass.new(2013,4,21), klass.new(2013,4,20),
172
+ klass.new(2013,4,14), klass.new(2013,4,13),
173
+ klass.new(2013,4,7), klass.new(2013,4,6),
174
+ ], klass.new(2013,4,1).all_non_week_days_of_month
175
+ end
176
+ end
177
+
178
+ def test_first_working_day_of_the_month
179
+ [Date].each do |klass|
180
+ assert_equal klass.new(2013,1,1), klass.new(2013,1,1).first_working_day_of_the_month
181
+ end
182
+ end
129
183
 
130
- end
184
+ end
@@ -6,31 +6,31 @@ RUBY_VERSION < '1.9' ? require('lib/week_of_month') : require_relative('../../we
6
6
 
7
7
 
8
8
  class TestWeek < Test::Unit::TestCase
9
-
9
+
10
10
  def test_week_of_month
11
- [Date,Time].each do |klass|
11
+ [Date,Time].each do |klass|
12
12
  assert_equal 5, klass.new(2013,1,31).week_of_month
13
-
13
+
14
14
  assert_equal 5, klass.new(2013,2,28).week_of_month
15
-
15
+
16
16
  assert_equal 6, klass.new(2013,3,31).week_of_month
17
-
17
+
18
18
  assert_equal 5, klass.new(2013,4,30).week_of_month
19
-
19
+
20
20
  assert_equal 5, klass.new(2013,5,31).week_of_month
21
-
21
+
22
22
  assert_equal 6, klass.new(2013,6,30).week_of_month
23
-
23
+
24
24
  assert_equal 5, klass.new(2013,7,31).week_of_month
25
-
25
+
26
26
  assert_equal 5, klass.new(2013,8,31).week_of_month
27
-
27
+
28
28
  assert_equal 5, klass.new(2013,9,30).week_of_month
29
-
29
+
30
30
  assert_equal 5, klass.new(2013,10,31).week_of_month
31
-
31
+
32
32
  assert_equal 5, klass.new(2013,11,30).week_of_month
33
-
33
+
34
34
  assert_equal 5, klass.new(2013,12,31).week_of_month
35
35
  end
36
36
  end
@@ -73,7 +73,7 @@ class TestWeek < Test::Unit::TestCase
73
73
  [27, 28, 29, 30, 31]]
74
74
  assert_kind_of Array,object.week_split
75
75
  assert_equal split_for_january, object.week_split
76
-
76
+
77
77
  object = Date.new(2013,2,15)
78
78
  split_for_october = [[nil, nil, nil, nil, nil, 1, 2],
79
79
  [3, 4, 5, 6, 7, 8, 9],
@@ -84,7 +84,7 @@ class TestWeek < Test::Unit::TestCase
84
84
  assert_equal split_for_october, object.week_split
85
85
  end
86
86
  end
87
-
87
+
88
88
  def test_first_week?
89
89
  [Date,Time].each do |klass|
90
90
  assert klass.new(2012,1,1).first_week?
@@ -103,14 +103,14 @@ class TestWeek < Test::Unit::TestCase
103
103
  [Date,Time].each do |klass|
104
104
  assert klass.new(2012,10,31).last_week?
105
105
  assert !klass.new(2012,10,20).last_week?
106
- end
106
+ end
107
107
  end
108
108
 
109
109
  def test_total_weeks
110
110
  [Date,Time].each do |klass|
111
111
  assert_equal 5, klass.new(2012,10,31).total_weeks
112
112
  assert_equal 6, klass.new(2012,12,20).total_weeks
113
- end
113
+ end
114
114
  end
115
115
 
116
116
  def test_week_of_month_in_eng
@@ -123,18 +123,18 @@ class TestWeek < Test::Unit::TestCase
123
123
  assert_equal 'Sixth', klass.new(2012,12,31).week_of_month_in_eng
124
124
  end
125
125
  end
126
-
126
+
127
127
  def test_week_of_month_in_fr
128
128
  [Date,Time].each do |klass|
129
- assert_equal 'First', klass.new(2012,12,1).week_of_month_in_fr
130
- assert_equal 'Second', klass.new(2012,12,4).week_of_month_in_fr
131
- assert_equal 'Third', klass.new(2012,12,9).week_of_month_in_fr
129
+ assert_equal 'Premier', klass.new(2012,12,1).week_of_month_in_fr
130
+ assert_equal 'Deuxième', klass.new(2012,12,4).week_of_month_in_fr
131
+ assert_equal 'Troisième', klass.new(2012,12,9).week_of_month_in_fr
132
132
  assert_equal 'Quatrième', klass.new(2012,12,16).week_of_month_in_fr
133
133
  assert_equal 'Cinquième', klass.new(2012,12,24).week_of_month_in_fr
134
- assert_equal 'sixième', klass.new(2012,12,31).week_of_month_in_fr
134
+ assert_equal 'Sixième', klass.new(2012,12,31).week_of_month_in_fr
135
135
  end
136
136
  end
137
-
137
+
138
138
  def test_week_of_month_in_ger
139
139
  [Date,Time].each do |klass|
140
140
  assert_equal 'First', klass.new(2012,12,1).week_of_month_in_ger
@@ -145,7 +145,7 @@ class TestWeek < Test::Unit::TestCase
145
145
  assert_equal 'Sechste', klass.new(2012,12,31).week_of_month_in_ger
146
146
  end
147
147
  end
148
-
148
+
149
149
  def test_week_of_month_in_jap
150
150
  [Date,Time].each do |klass|
151
151
  assert_equal '最初', klass.new(2012,12,1).week_of_month_in_jap
@@ -156,7 +156,7 @@ class TestWeek < Test::Unit::TestCase
156
156
  assert_equal 'シックス', klass.new(2012,12,31).week_of_month_in_jap
157
157
  end
158
158
  end
159
-
159
+
160
160
  def test_week_end?
161
161
  [Date,Time].each do |klass|
162
162
  assert !klass.new(2012,10,1).week_end?
@@ -165,7 +165,7 @@ class TestWeek < Test::Unit::TestCase
165
165
  assert klass.new(2012,10,7).week_end?
166
166
  end
167
167
  end
168
-
168
+
169
169
  def test_working_day?
170
170
  [Date,Time].each do |klass|
171
171
  assert klass.new(2012,10,1).working_day?
@@ -175,51 +175,71 @@ class TestWeek < Test::Unit::TestCase
175
175
  end
176
176
  end
177
177
 
178
- def test_days_past_in_week
179
- [Date,Time].each do |klass|
180
- assert_equal 2, klass.new(2013,1,1).days_past_in_week
181
- end
182
- end
183
-
184
- def test_days_left_in_week
185
- [Date,Time].each do |klass|
186
- assert_equal 5, klass.new(2013,1,1).days_left_in_week
187
- end
188
- end
189
-
190
- def test_beginning_of_week
191
- [Date,Time].each do |klass|
192
- assert_equal klass.new(2012,11,25), klass.new(2012,11,26).beginning_of_week
193
- assert_equal klass.new(2012,11,25), klass.new(2012,11,25).beginning_of_week
194
- assert_equal klass.new(2012,11,25), klass.new(2012,11,30).beginning_of_week
195
- end
196
- end
197
-
198
- def test_end_of_week
199
- [Date,Time].each do |klass|
200
- assert_equal klass.new(2012,12,1), klass.new(2012,12,1).end_of_week
201
- assert_equal klass.new(2012,12,8), klass.new(2012,12,2).end_of_week
202
- assert_equal klass.new(2012,12,8), klass.new(2012,12,3).end_of_week
203
- assert_equal klass.new(2012,12,8), klass.new(2012,12,7).end_of_week
204
- end
205
- end
206
-
207
- def test_next_week
208
- [Date,Time].each do |klass|
209
- assert_equal klass.new(2012,12,8), klass.new(2012,12,1).next_week
210
- assert_equal klass.new(2012,12,22), klass.new(2012,12,15).next_week
211
- assert_equal klass.new(2013,1,5), klass.new(2012,12,29).next_week
212
- assert_equal klass.new(2012,12,26), klass.new(2012,12,19).next_week
213
- end
214
- end
215
-
216
- def test_previous_week
217
- [Date,Time].each do |klass|
218
- assert_equal klass.new(2012,12,1), klass.new(2012,12,8).previous_week
219
- assert_equal klass.new(2012,12,15), klass.new(2012,12,22).previous_week
220
- assert_equal klass.new(2012,12,29), klass.new(2013,1,5).previous_week
221
- assert_equal klass.new(2012,12,19), klass.new(2012,12,26).previous_week
222
- end
223
- end
224
-
225
- end
178
+ def test_days_past_in_week
179
+ [Date,Time].each do |klass|
180
+ assert_equal 2, klass.new(2013,1,1).days_past_in_week
181
+ end
182
+ end
183
+
184
+ def test_days_left_in_week
185
+ [Date,Time].each do |klass|
186
+ assert_equal 5, klass.new(2013,1,1).days_left_in_week
187
+ end
188
+ end
189
+
190
+ def test_beginning_of_week
191
+ [Date,Time].each do |klass|
192
+ assert_equal klass.new(2012,11,25), klass.new(2012,11,25).beginning_of_week
193
+ assert_equal klass.new(2012,11,25), klass.new(2012,11,26).beginning_of_week
194
+ assert_equal klass.new(2012,11,25), klass.new(2012,11,30).beginning_of_week
195
+ end
196
+ end
197
+
198
+ def test_end_of_week
199
+ [Date,Time].each do |klass|
200
+ assert_equal klass.new(2012,12,1), klass.new(2012,12,1).end_of_week
201
+ assert_equal klass.new(2012,12,8), klass.new(2012,12,2).end_of_week
202
+ assert_equal klass.new(2012,12,8), klass.new(2012,12,3).end_of_week
203
+ assert_equal klass.new(2012,12,8), klass.new(2012,12,7).end_of_week
204
+ end
205
+ end
206
+
207
+ def test_next_week
208
+ [Date,Time].each do |klass|
209
+ assert_equal klass.new(2012,12,8), klass.new(2012,12,1).next_week
210
+ assert_equal klass.new(2012,12,22), klass.new(2012,12,15).next_week
211
+ assert_equal klass.new(2013,1,5), klass.new(2012,12,29).next_week
212
+ assert_equal klass.new(2012,12,26), klass.new(2012,12,19).next_week
213
+ end
214
+ end
215
+
216
+ def test_previous_week
217
+ [Date,Time].each do |klass|
218
+ assert_equal klass.new(2012,12,1), klass.new(2012,12,8).previous_week
219
+ assert_equal klass.new(2012,12,15), klass.new(2012,12,22).previous_week
220
+ assert_equal klass.new(2012,12,29), klass.new(2013,1,5).previous_week
221
+ assert_equal klass.new(2012,12,19), klass.new(2012,12,26).previous_week
222
+ end
223
+ end
224
+
225
+ def test_monday_configured_beginning_of_week
226
+ WeekOfMonth.configuration.monday_active = true
227
+ [Date,Time].each do |klass|
228
+ assert_equal klass.new(2012,11,19), klass.new(2012,11,25).beginning_of_week
229
+ assert_equal klass.new(2012,11,26), klass.new(2012,11,26).beginning_of_week
230
+ assert_equal klass.new(2012,11,26), klass.new(2012,11,30).beginning_of_week
231
+ end
232
+ WeekOfMonth.configuration.monday_active = false
233
+ end
234
+
235
+ def test_monday_configured_end_of_week
236
+ WeekOfMonth.configuration.monday_active = true
237
+ [Date,Time].each do |klass|
238
+ assert_equal klass.new(2012,12,2), klass.new(2012,12,1).end_of_week
239
+ assert_equal klass.new(2012,12,2), klass.new(2012,12,2).end_of_week
240
+ assert_equal klass.new(2012,12,9), klass.new(2012,12,3).end_of_week
241
+ assert_equal klass.new(2012,12,9), klass.new(2012,12,7).end_of_week
242
+ end
243
+ WeekOfMonth.configuration.monday_active = false
244
+ end
245
+ end
@@ -1,10 +1,12 @@
1
1
  require 'date'
2
2
  require 'time'
3
3
 
4
- def require_file file_name
4
+ # supports both version of ruby 1.8 and 1.9 for loading a file.
5
+ def require_file(file_name)
5
6
  RUBY_VERSION < '1.9' ? require(file_name) : require_relative(file_name)
6
7
  end
7
8
 
9
+ require_file 'modules/configuration'
8
10
  require_file 'modules/day'
9
11
  require_file 'modules/month'
10
12
  require_file 'modules/week'
@@ -27,6 +29,7 @@ end
27
29
  end
28
30
  end
29
31
 
32
+ # these methods are already defined in ruby 1.9 and above
30
33
  unless method_defined?(:sunday?)
31
34
  def sunday? ; self.wday == 0; end
32
35
  def monday? ; self.wday == 1; end
@@ -46,7 +49,7 @@ class Time
46
49
  include WeekOfMonth::Month
47
50
  include WeekOfMonth::Week
48
51
  include WeekOfMonth::Year
49
-
52
+
50
53
  def leap?
51
54
  self.to_date.leap?
52
55
  end
@@ -69,8 +72,13 @@ class Hash
69
72
  end
70
73
 
71
74
  module WeekOfMonth
75
+ class << self
76
+ # A WeekOfMonth configuration object. Must act like a hash
77
+ # See WeekOfMonth::Configuration.
78
+ attr_writer :configuration
79
+ end
72
80
 
73
- def self.first_day=val
81
+ def self.first_day=(val)
74
82
  @first_day = DAYS_IN_SEQUENCE[val]
75
83
  end
76
84
 
@@ -78,9 +86,16 @@ module WeekOfMonth
78
86
  @first_day ||= 0
79
87
  end
80
88
 
81
- def self.configure
82
- yield
89
+ def self.configuration
90
+ @configuration ||= Configuration.new
83
91
  end
84
92
 
93
+ def self.configuration=(config)
94
+ @configuration = config
95
+ end
96
+
97
+ def self.configure
98
+ yield configuration
99
+ end
85
100
  end
86
101
 
data/license CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2012-2014 Sachin Singh
3
+ Copyright (c) 2012-2016 Sachin Singh
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,13 +1,14 @@
1
+ # @author Sachin Singh
2
+
1
3
  require File.expand_path('../lib/modules/version', __FILE__)
2
4
 
3
5
  Gem::Specification.new do |s|
4
6
  s.name = 'week_of_month'
5
7
  s.version = WeekOfMonth::VERSION
6
- s.date = '2014-07-28'
7
- s.summary = 'Week Of Month!'
8
+ s.summary = 'Week of month!'
8
9
  s.description = 'Its gives you week_of_month method on date and time objects, that returns week of the month.'
9
- s.authors = ['Sachin Singh', 'Tommy']
10
- s.email = ['sachin@railsdeveloper.in', 'sachin.y87@gmail.com', 'singhsachin87@yahoo.com']
10
+ s.authors = %w(Sachin87 Tommyixi Matt-- berikin pablorusso AstonJ swapnilchincholkar hitendrasingh ilake)
11
+ s.email = %w(sachin@railsdeveloper.in sachin.y87@gmail.com singhsachin87@yahoo.com)
11
12
  s.homepage = 'https://github.com/sachin87/week-of-month'
12
13
  s.files = `git ls-files`.split("\n").sort
13
14
  s.require_paths = ['lib']
@@ -15,4 +16,5 @@ Gem::Specification.new do |s|
15
16
 
16
17
  s.add_development_dependency 'rake', '>= 10.1.0'
17
18
  s.add_development_dependency 'bundler', '>= 1.0'
19
+ s.add_development_dependency 'test-unit'
18
20
  end
metadata CHANGED
@@ -1,15 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: week_of_month
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3.2
4
+ version: 1.2.3.4
5
5
  platform: ruby
6
6
  authors:
7
- - Sachin Singh
8
- - Tommy
7
+ - Sachin87
8
+ - Tommyixi
9
+ - Matt--
10
+ - berikin
11
+ - pablorusso
12
+ - AstonJ
13
+ - swapnilchincholkar
14
+ - hitendrasingh
15
+ - ilake
9
16
  autorequire:
10
17
  bindir: bin
11
18
  cert_chain: []
12
- date: 2014-07-28 00:00:00.000000000 Z
19
+ date: 2016-01-02 00:00:00.000000000 Z
13
20
  dependencies:
14
21
  - !ruby/object:Gem::Dependency
15
22
  name: rake
@@ -39,6 +46,20 @@ dependencies:
39
46
  - - ">="
40
47
  - !ruby/object:Gem::Version
41
48
  version: '1.0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: test-unit
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
42
63
  description: Its gives you week_of_month method on date and time objects, that returns
43
64
  week of the month.
44
65
  email:
@@ -55,6 +76,7 @@ files:
55
76
  - Gemfile.lock
56
77
  - README.md
57
78
  - Rakefile
79
+ - lib/modules/configuration.rb
58
80
  - lib/modules/constant.rb
59
81
  - lib/modules/day.rb
60
82
  - lib/modules/month.rb
@@ -89,8 +111,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
111
  version: '0'
90
112
  requirements: []
91
113
  rubyforge_project:
92
- rubygems_version: 2.2.2
114
+ rubygems_version: 2.4.6
93
115
  signing_key:
94
116
  specification_version: 4
95
- summary: Week Of Month!
117
+ summary: Week of month!
96
118
  test_files: []
119
+ has_rdoc: