DayFinder 0.1.0 → 0.2.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: 61d6692148eea6f972fc6e39ac37164939d744abac39dd4f88793b2b7296166d
4
- data.tar.gz: 4e1b2d8bd1ed7613f166a5a94116a86570859fb1ba8992eb06cbee453604f925
3
+ metadata.gz: 2c438106af73794d9fb77b6dbc0c4c1c8a1c7c3f8a6adb0330d4e6f3eb03768f
4
+ data.tar.gz: 3f0b28264069167508a614db0c2c9f19fa36fefcff68a7c63effae633716b9b3
5
5
  SHA512:
6
- metadata.gz: d27d63216f62f8463525e9900618cf874b8ea8e41ce3086916126c7580fecef50c1fa2245a555ee686bc33e6885ce82facafb994c7291d40c6e982f9ed7e8a73
7
- data.tar.gz: 848252c253cb20e226cc44ccc556b9f358f715a95bcb0012a31b3c8a922314b1455135039140b41c033adc249906a6dc33d0b3665bc404a35632089607e0721e
6
+ metadata.gz: 95365f87bf685023856524e99b1655a2c80aa8c83f3adb26bde52450671298fd204201f64b5d4cc84eb274ee4f42930e53c2a465d2a998a232850cb95ac07b59
7
+ data.tar.gz: b4adc131ed0dd5695cea3a5db5a429f09e67b499fdbae9a79d31711cffdaed9af858d8d06b3c1d33eacacebd360af3355f36e8f6d8563eab70761d48ad3e4939
data/.idea/DayFinder.iml CHANGED
@@ -15,4 +15,9 @@
15
15
  <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.3, rbenv: 3.0.0) [gem]" level="application" />
16
16
  <orderEntry type="library" scope="PROVIDED" name="rbs (v1.0.0, rbenv: 3.0.0) [gem]" level="application" />
17
17
  </component>
18
+ <component name="RakeTasksCache">
19
+ <option name="myRootTask">
20
+ <RakeTaskImpl id="rake" />
21
+ </option>
22
+ </component>
18
23
  </module>
data/.idea/workspace.xml CHANGED
@@ -1,9 +1,8 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
- <list default="true" id="a023c905-22f2-4314-9083-cfceccb270ad" name="Default Changelist" comment="">
4
+ <list default="true" id="a023c905-22f2-4314-9083-cfceccb270ad" name="Default Changelist" comment="Readme updated">
5
5
  <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
- <change beforePath="$PROJECT_DIR$/DayFinder.gemspec" beforeDir="false" afterPath="$PROJECT_DIR$/DayFinder.gemspec" afterDir="false" />
7
6
  <change beforePath="$PROJECT_DIR$/lib/DayFinder.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/DayFinder.rb" afterDir="false" />
8
7
  </list>
9
8
  <option name="SHOW_DIALOG" value="false" />
@@ -15,18 +14,71 @@
15
14
  <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
16
15
  </component>
17
16
  <component name="ProjectId" id="1vTq5Iax0Go21U7z9Iz5SKzXLMV" />
18
- <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
17
+ <component name="ProjectLevelVcsManager" settingsEditedManually="true">
18
+ <ConfirmationsSetting value="2" id="Add" />
19
+ </component>
19
20
  <component name="ProjectViewState">
20
21
  <option name="hideEmptyMiddlePackages" value="true" />
21
22
  <option name="showLibraryContents" value="true" />
22
23
  <option name="showMembers" value="true" />
23
24
  </component>
24
25
  <component name="PropertiesComponent">
26
+ <property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
25
27
  <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
26
28
  <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
27
29
  <property name="WebServerToolWindowFactoryState" value="false" />
30
+ <property name="node.js.detected.package.eslint" value="true" />
31
+ <property name="node.js.detected.package.tslint" value="true" />
32
+ <property name="node.js.selected.package.eslint" value="(autodetect)" />
33
+ <property name="node.js.selected.package.tslint" value="(autodetect)" />
34
+ <property name="nodejs_package_manager_path" value="npm" />
35
+ </component>
36
+ <component name="RunAnythingCache">
37
+ <option name="myCommands">
38
+ <command value="gem install hello_rubymine" />
39
+ <command value="gem install DayFinder-0.1.0.gem" />
40
+ </option>
28
41
  </component>
29
- <component name="RunManager">
42
+ <component name="RunManager" selected="Ruby.DayFinder">
43
+ <configuration name="IRB: DayFinder" type="IrbRunConfigurationType" factoryName="IRB console" temporary="true">
44
+ <module name="DayFinder" />
45
+ <IRB_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
46
+ <IRB_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$" />
47
+ <IRB_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
48
+ <IRB_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
49
+ <IRB_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
50
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
51
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
52
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" IGNORE_RCOVRT="true" ENABLE_BRANCH_COVERAGE="true" ENABLE_FORKED_COVERAGE="true">
53
+ <COVERAGE_PATTERN ENABLED="true">
54
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
55
+ </COVERAGE_PATTERN>
56
+ </EXTENSION>
57
+ <EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
58
+ <IRB_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$USER_HOME$/.rbenv/versions/3.0.0/bin/irb" />
59
+ <IRB_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="--simple-prompt --nomultiline --nocolorize" />
60
+ <IRB_RUN_CONFIG NAME="CONSOLE_TYPE" VALUE="IRB" />
61
+ <method v="2" />
62
+ </configuration>
63
+ <configuration name="DayFinder" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
64
+ <module name="DayFinder" />
65
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
66
+ <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="" />
69
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
70
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
71
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
72
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" IGNORE_RCOVRT="true" ENABLE_BRANCH_COVERAGE="true" ENABLE_FORKED_COVERAGE="true">
73
+ <COVERAGE_PATTERN ENABLED="true">
74
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
75
+ </COVERAGE_PATTERN>
76
+ </EXTENSION>
77
+ <EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
78
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/DayFinder.rb" />
79
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
80
+ <method v="2" />
81
+ </configuration>
30
82
  <configuration name="x" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
31
83
  <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
32
84
  <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$USER_HOME$/Desktop" />
@@ -47,6 +99,8 @@
47
99
  </configuration>
48
100
  <recent_temporary>
49
101
  <list>
102
+ <item itemvalue="Ruby.DayFinder" />
103
+ <item itemvalue="Ruby Console.IRB: DayFinder" />
50
104
  <item itemvalue="Ruby.x" />
51
105
  </list>
52
106
  </recent_temporary>
@@ -60,14 +114,50 @@
60
114
  <option name="number" value="Default" />
61
115
  <option name="presentableId" value="Default" />
62
116
  <updated>1626596242263</updated>
63
- <workItem from="1626596243999" duration="786000" />
117
+ <workItem from="1626596243999" duration="2156000" />
118
+ <workItem from="1626788900302" duration="651000" />
119
+ </task>
120
+ <task id="LOCAL-00001" summary="code added">
121
+ <created>1626597241055</created>
122
+ <option name="number" value="00001" />
123
+ <option name="presentableId" value="LOCAL-00001" />
124
+ <option name="project" value="LOCAL" />
125
+ <updated>1626597241056</updated>
64
126
  </task>
127
+ <task id="LOCAL-00002" summary="Readme updated">
128
+ <created>1626598245018</created>
129
+ <option name="number" value="00002" />
130
+ <option name="presentableId" value="LOCAL-00002" />
131
+ <option name="project" value="LOCAL" />
132
+ <updated>1626598245018</updated>
133
+ </task>
134
+ <option name="localTasksCounter" value="3" />
65
135
  <servers />
66
136
  </component>
67
137
  <component name="TypeScriptGeneratedFilesManager">
68
138
  <option name="version" value="3" />
69
139
  </component>
140
+ <component name="Vcs.Log.Tabs.Properties">
141
+ <option name="TAB_STATES">
142
+ <map>
143
+ <entry key="MAIN">
144
+ <value>
145
+ <State />
146
+ </value>
147
+ </entry>
148
+ </map>
149
+ </option>
150
+ <option name="oldMeFiltersMigrated" value="true" />
151
+ </component>
152
+ <component name="VcsManagerConfiguration">
153
+ <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
154
+ <MESSAGE value="code added" />
155
+ <MESSAGE value="Readme updated" />
156
+ <option name="LAST_COMMIT_MESSAGE" value="Readme updated" />
157
+ </component>
70
158
  <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" />
71
160
  <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" />
161
+ <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" />
72
162
  </component>
73
163
  </project>
Binary file
data/README.md CHANGED
@@ -1,13 +1,22 @@
1
- # DayFinder
1
+ # DayFinder [![Gem Version](https://badge.fury.io/rb/DayFinder.svg)](https://badge.fury.io/rb/DayFinder)
2
+ DayFinder is a ruby gem. It is used to find the weekday of a given date.
2
3
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/DayFinder`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
5
+ # Syntax
6
+ ```ruby
7
+ DayFinder.find(date,month,year)
8
+ ```
8
9
 
9
- Add this line to your application's Gemfile:
10
+ # Example
11
+ ```ruby
12
+ require 'DayFinder'
13
+ day=DayFinder.find 15,8,1947
14
+ puts day
15
+ #output
16
+ # Friday
17
+ ```
10
18
 
19
+ ## Installation
11
20
  ```ruby
12
21
  gem 'DayFinder'
13
22
  ```
@@ -20,19 +29,10 @@ Or install it yourself as:
20
29
 
21
30
  $ gem install DayFinder
22
31
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
32
 
33
33
  ## Contributing
34
34
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/DayFinder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/DayFinder/blob/master/CODE_OF_CONDUCT.md).
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/freakflames29/DayFinder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/freakflames29/DayFinder/blob/master/CODE_OF_CONDUCT.md).
36
36
 
37
37
  ## License
38
38
 
data/lib/DayFinder.rb CHANGED
@@ -7,10 +7,16 @@ module DayFinder
7
7
 
8
8
  # Your code goes here...
9
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]
10
13
  leap = false
11
14
  leap = true if ((year % 4).zero? && (year % 100 != 0)) || (year % 400).zero?
12
15
  raise "day is invalid" if (m == 2) && (d >= 30)
13
16
  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)
18
+ raise "Day is invalid" if d <= 0
19
+ raise "Month invalid " if !month_31.include?(m) && !month_30.include?(m) && !month_28.include?(m)
14
20
 
15
21
  if m > 2
16
22
  mo = m
@@ -26,4 +32,4 @@ module DayFinder
26
32
  # puts leap
27
33
  weekday[w]
28
34
  end
29
- end
35
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DayFinder
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  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.1.0
4
+ version: 0.2.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-18 00:00:00.000000000 Z
11
+ date: 2021-07-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: DayFinder gem will return the weekday of a given date.
14
14
  email:
@@ -26,6 +26,7 @@ files:
26
26
  - ".rspec"
27
27
  - ".rubocop.yml"
28
28
  - CODE_OF_CONDUCT.md
29
+ - DayFinder-0.1.0.gem
29
30
  - DayFinder.gemspec
30
31
  - Gemfile
31
32
  - LICENSE.txt