DayFinder 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 2c438106af73794d9fb77b6dbc0c4c1c8a1c7c3f8a6adb0330d4e6f3eb03768f
4
- data.tar.gz: 3f0b28264069167508a614db0c2c9f19fa36fefcff68a7c63effae633716b9b3
3
+ metadata.gz: 6a378c32e05f6c012683224127bcfddbc5f1c1fb205dd1e88bda144b892bbd3c
4
+ data.tar.gz: 8feb0805661efc152de94827b8fa3398bef54af34732261b1021f5ab573fe9b2
5
5
  SHA512:
6
- metadata.gz: 95365f87bf685023856524e99b1655a2c80aa8c83f3adb26bde52450671298fd204201f64b5d4cc84eb274ee4f42930e53c2a465d2a998a232850cb95ac07b59
7
- data.tar.gz: b4adc131ed0dd5695cea3a5db5a429f09e67b499fdbae9a79d31711cffdaed9af858d8d06b3c1d33eacacebd360af3355f36e8f6d8563eab70761d48ad3e4939
6
+ metadata.gz: ecc6455f8e6bdddeb6ef7d8a6eaccea0dd66c9a8c2935ac4e9fac372cffab07502d7fce591ffa25d3263467f30263f0500432a5ec11fab07069b52c2c3752d96
7
+ data.tar.gz: 2c6404730e9e29127f09d7920beb2e3a2ec8a5472a3ac970074c5243f2556e3f60010b338319db6542a2f948663a93c81cf61a49fe80e07a1ef6260ba10be827
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ /.idea/
13
+ *.xml
data/.idea/DayFinder.iml CHANGED
@@ -8,12 +8,13 @@
8
8
  <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
9
  <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
10
  <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ <excludeFolder url="file://$MODULE_DIR$/.idea/inspectionProfiles" />
11
12
  </content>
12
- <orderEntry type="jdk" jdkName="rbenv: 3.0.0" jdkType="RUBY_SDK" />
13
+ <orderEntry type="jdk" jdkName="rbenv: 3.0.2" jdkType="RUBY_SDK" />
13
14
  <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.4, rbenv: 3.0.0) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.3, rbenv: 3.0.0) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="rbs (v1.0.0, rbenv: 3.0.0) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.28, rbenv: 3.0.2) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.3, rbenv: 3.0.2) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="rbs (v1.0.4, rbenv: 3.0.2) [gem]" level="application" />
17
18
  </component>
18
19
  <component name="RakeTasksCache">
19
20
  <option name="myRootTask">
data/.idea/workspace.xml CHANGED
@@ -1,8 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="SELECTIVE" />
5
+ </component>
3
6
  <component name="ChangeListManager">
4
- <list default="true" id="a023c905-22f2-4314-9083-cfceccb270ad" name="Default Changelist" comment="Readme updated">
5
- <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
7
+ <list default="true" id="a023c905-22f2-4314-9083-cfceccb270ad" name="Default Changelist" comment="version.rb updated">
6
8
  <change beforePath="$PROJECT_DIR$/lib/DayFinder.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/DayFinder.rb" afterDir="false" />
7
9
  </list>
8
10
  <option name="SHOW_DIALOG" value="false" />
@@ -11,8 +13,21 @@
11
13
  <option name="LAST_RESOLUTION" value="IGNORE" />
12
14
  </component>
13
15
  <component name="Git.Settings">
16
+ <option name="RECENT_BRANCH_BY_REPOSITORY">
17
+ <map>
18
+ <entry key="$PROJECT_DIR$" value="main" />
19
+ </map>
20
+ </option>
14
21
  <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
15
22
  </component>
23
+ <component name="GitSEFilterConfiguration">
24
+ <file-type-list>
25
+ <filtered-out-file-type name="LOCAL_BRANCH" />
26
+ <filtered-out-file-type name="REMOTE_BRANCH" />
27
+ <filtered-out-file-type name="TAG" />
28
+ <filtered-out-file-type name="COMMIT_BY_MESSAGE" />
29
+ </file-type-list>
30
+ </component>
16
31
  <component name="ProjectId" id="1vTq5Iax0Go21U7z9Iz5SKzXLMV" />
17
32
  <component name="ProjectLevelVcsManager" settingsEditedManually="true">
18
33
  <ConfirmationsSetting value="2" id="Add" />
@@ -32,11 +47,13 @@
32
47
  <property name="node.js.selected.package.eslint" value="(autodetect)" />
33
48
  <property name="node.js.selected.package.tslint" value="(autodetect)" />
34
49
  <property name="nodejs_package_manager_path" value="npm" />
50
+ <property name="settings.editor.selected.configurable" value="preferences.editor" />
35
51
  </component>
36
52
  <component name="RunAnythingCache">
37
53
  <option name="myCommands">
38
54
  <command value="gem install hello_rubymine" />
39
55
  <command value="gem install DayFinder-0.1.0.gem" />
56
+ <command value="gem install DayFinder-0.2.0.gem" />
40
57
  </option>
41
58
  </component>
42
59
  <component name="RunManager" selected="Ruby.DayFinder">
@@ -64,8 +81,8 @@
64
81
  <module name="DayFinder" />
65
82
  <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
66
83
  <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib" />
67
- <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
68
- <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
84
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="true" />
85
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="rbenv: 3.0.2" />
69
86
  <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
70
87
  <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
71
88
  <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
@@ -79,6 +96,24 @@
79
96
  <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
80
97
  <method v="2" />
81
98
  </configuration>
99
+ <configuration name="ruby" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
100
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
101
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$USER_HOME$/Desktop" />
102
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
103
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
104
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
105
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
106
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
107
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" ENABLE_BRANCH_COVERAGE="true" ENABLE_FORKED_COVERAGE="true">
108
+ <COVERAGE_PATTERN ENABLED="true">
109
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
110
+ </COVERAGE_PATTERN>
111
+ </EXTENSION>
112
+ <EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
113
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$USER_HOME$/Desktop/ruby.rb" />
114
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
115
+ <method v="2" />
116
+ </configuration>
82
117
  <configuration name="x" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
83
118
  <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
84
119
  <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$USER_HOME$/Desktop" />
@@ -97,9 +132,17 @@
97
132
  <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
98
133
  <method v="2" />
99
134
  </configuration>
135
+ <list>
136
+ <item itemvalue="Ruby.ruby" />
137
+ <item itemvalue="Ruby.DayFinder" />
138
+ <item itemvalue="Ruby.x" />
139
+ <item itemvalue="Ruby Console.IRB: DayFinder" />
140
+ </list>
100
141
  <recent_temporary>
101
142
  <list>
102
143
  <item itemvalue="Ruby.DayFinder" />
144
+ <item itemvalue="Ruby.ruby" />
145
+ <item itemvalue="Ruby Console.IRB: DayFinder" />
103
146
  <item itemvalue="Ruby Console.IRB: DayFinder" />
104
147
  <item itemvalue="Ruby.x" />
105
148
  </list>
@@ -115,7 +158,8 @@
115
158
  <option name="presentableId" value="Default" />
116
159
  <updated>1626596242263</updated>
117
160
  <workItem from="1626596243999" duration="2156000" />
118
- <workItem from="1626788900302" duration="651000" />
161
+ <workItem from="1626788900302" duration="1046000" />
162
+ <workItem from="1636001078267" duration="1693000" />
119
163
  </task>
120
164
  <task id="LOCAL-00001" summary="code added">
121
165
  <created>1626597241055</created>
@@ -131,7 +175,14 @@
131
175
  <option name="project" value="LOCAL" />
132
176
  <updated>1626598245018</updated>
133
177
  </task>
134
- <option name="localTasksCounter" value="3" />
178
+ <task id="LOCAL-00003" summary="version.rb updated">
179
+ <created>1636003537429</created>
180
+ <option name="number" value="00003" />
181
+ <option name="presentableId" value="LOCAL-00003" />
182
+ <option name="project" value="LOCAL" />
183
+ <updated>1636003537429</updated>
184
+ </task>
185
+ <option name="localTasksCounter" value="4" />
135
186
  <servers />
136
187
  </component>
137
188
  <component name="TypeScriptGeneratedFilesManager">
@@ -153,11 +204,15 @@
153
204
  <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
154
205
  <MESSAGE value="code added" />
155
206
  <MESSAGE value="Readme updated" />
156
- <option name="LAST_COMMIT_MESSAGE" value="Readme updated" />
207
+ <MESSAGE value="findall days feature" />
208
+ <MESSAGE value="version.rb updated" />
209
+ <option name="LAST_COMMIT_MESSAGE" value="version.rb updated" />
157
210
  </component>
158
211
  <component name="com.intellij.coverage.CoverageDataManagerImpl">
159
- <SUITE FILE_PATH="coverage/DayFinder@IRB__DayFinder.rcov" NAME="IRB: DayFinder Coverage Results" MODIFIED="1626789282186" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="DayFinder" />
212
+ <SUITE FILE_PATH="coverage/DayFinder@IRB__DayFinder.rcov" NAME="IRB: DayFinder Coverage Results" MODIFIED="1626789698769" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="DayFinder" />
213
+ <SUITE FILE_PATH="coverage/rubyprojcts@DayFinder.rcov" NAME="DayFinder Coverage Results" MODIFIED="1636003108088" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib" MODULE_NAME="DayFinder" />
160
214
  <SUITE FILE_PATH="coverage/DayFinder@x.rcov" NAME="x Coverage Results" MODIFIED="1626596978455" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$USER_HOME$/Desktop" MODULE_NAME="DayFinder" />
215
+ <SUITE FILE_PATH="coverage/rubyprojcts@ruby.rcov" NAME="ruby Coverage Results" MODIFIED="1636001830203" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$USER_HOME$/Desktop" MODULE_NAME="DayFinder" />
161
216
  <SUITE FILE_PATH="coverage/DayFinder@DayFinder.rcov" NAME="DayFinder Coverage Results" MODIFIED="1626789556515" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib" MODULE_NAME="DayFinder" />
162
217
  </component>
163
218
  </project>
Binary file
data/README.md CHANGED
@@ -4,7 +4,7 @@ DayFinder is a ruby gem. It is used to find the weekday of a given date.
4
4
 
5
5
  # Syntax
6
6
  ```ruby
7
- DayFinder.find(date,month,year)
7
+ DayFinder.find(day,month,year)
8
8
  ```
9
9
 
10
10
  # Example
@@ -40,4 +40,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
40
 
41
41
  ## Code of Conduct
42
42
 
43
- Everyone interacting in the DayFinder project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/DayFinder/blob/master/CODE_OF_CONDUCT.md).
43
+ Everyone interacting in the DayFinder project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/freakflames29/DayFinder/blob/main/CODE_OF_CONDUCT.md).
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DayFinder
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/DayFinder.rb CHANGED
@@ -6,17 +6,20 @@ module DayFinder
6
6
  class Error < StandardError; end
7
7
 
8
8
  # Your code goes here...
9
- def self.find d,m,year
10
- month_31 = [1,3,5,7,8,10,12]
11
- month_30 = [11,4,6,9]
12
- month_28=[2]
9
+ M31 = [1, 3, 5, 7, 8, 10, 12]
10
+ M30 = [11, 4, 6, 9]
11
+ WEEKDAY = %w[Saturday Sunday Monday Tuesday Wednesday Thursday Friday]
12
+ $week = 0
13
+
14
+ def self.find d, m, year
15
+ month_28 = [2]
13
16
  leap = false
14
17
  leap = true if ((year % 4).zero? && (year % 100 != 0)) || (year % 400).zero?
15
18
  raise "day is invalid" if (m == 2) && (d >= 30)
16
19
  raise "month 2 date invalid" if !leap && m == 2 && d >= 29
17
- raise "Invalid date" if (month_31.include?(m) && d >= 32 && d != 0) || (month_30.include?(m) && d >= 31 && d != 0)
20
+ raise "Invalid date" if (M31.include?(m) && d >= 32 && d != 0) || (M30.include?(m) && d >= 31 && d != 0)
18
21
  raise "Day is invalid" if d <= 0
19
- raise "Month invalid " if !month_31.include?(m) && !month_30.include?(m) && !month_28.include?(m)
22
+ raise "Month invalid " if !M31.include?(m) && !M30.include?(m) && !month_28.include?(m)
20
23
 
21
24
  if m > 2
22
25
  mo = m
@@ -28,8 +31,43 @@ module DayFinder
28
31
  c = year / 100
29
32
  x = d + (13 * (mo + 1)) / 5 + y + (y / 4) + (c / 4) + 5 * c
30
33
  w = x % 7
31
- weekday = %w[Saturday Sunday Monday Tuesday Wednesday Thursday Friday]
34
+ $week = w
32
35
  # puts leap
33
- weekday[w]
36
+ WEEKDAY[w]
37
+ # w
38
+ end
39
+
40
+ def self.findAll m, year, day
41
+ leap = true if ((year % 4).zero? && (year % 100 != 0)) || (year % 400).zero?
42
+ if leap and m == 2
43
+ days = 29
44
+ elsif M31.include?(m)
45
+ days = 31
46
+ elsif M30.include?(m)
47
+ days = 30
48
+ else
49
+ days = 28
50
+ end
51
+ find 1, m, year
52
+ dayslist = []
53
+ if WEEKDAY[$week] == day.capitalize
54
+ i = 1
55
+ while (i <= days)
56
+ dayslist << i
57
+ i += 7
58
+ end
59
+ else
60
+ for i in (1..days)
61
+ find i, m, year
62
+ if WEEKDAY[$week] == day.capitalize
63
+ break
64
+ end
65
+ end
66
+ while (i <= days)
67
+ dayslist << i
68
+ i += 7
69
+ end
70
+ end
71
+ dayslist
34
72
  end
35
- end
73
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: DayFinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sourav Das
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-20 00:00:00.000000000 Z
11
+ date: 2021-11-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: DayFinder gem will return the weekday of a given date.
14
14
  email:
@@ -27,6 +27,7 @@ files:
27
27
  - ".rubocop.yml"
28
28
  - CODE_OF_CONDUCT.md
29
29
  - DayFinder-0.1.0.gem
30
+ - DayFinder-0.2.0.gem
30
31
  - DayFinder.gemspec
31
32
  - Gemfile
32
33
  - LICENSE.txt
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  - !ruby/object:Gem::Version
58
59
  version: '0'
59
60
  requirements: []
60
- rubygems_version: 3.2.3
61
+ rubygems_version: 3.2.22
61
62
  signing_key:
62
63
  specification_version: 4
63
64
  summary: DayFinder gem is used to find the weekday of a given date