days_of_march 0.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 014a101d6d1957c9468a0cb553cbb69e27bdac154884dc9a4424557122e1898c
4
+ data.tar.gz: a3555c721363691a50f44d18d622749975c9aaaaacaaf85033e94ea5ce3ae529
5
+ SHA512:
6
+ metadata.gz: 7a17d6a5ce154d3eb93880ad3240fc7e9e6c2ff478f08fbb180af3ea5ec62717c28750b9e303ad0f52c561a62336ddfa09b1e8940d6d747446d4fd1805834ecf
7
+ data.tar.gz: 35ae07ade588d0197f42a3ff2996698dbaef2eba3701d87f31f2001c20f994a64cb5034ebe95e60d10b940bf190fab24ddfca623312534a9b2a4412d7c62fd3b
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'days_of_march'
4
+ puts DaysOfMarch.today
@@ -0,0 +1,26 @@
1
+ require 'date'
2
+
3
+ module DaysOfMarch
4
+ def self.days_since_march_first
5
+ march_first = Date.new(2020, 3, 1)
6
+ (Date.today - march_first).to_i
7
+ end
8
+
9
+ def self.ordinal_indicator(number)
10
+ right_digit = number % 10
11
+ case right_digit
12
+ when 1
13
+ 'st'
14
+ when 2
15
+ 'nd'
16
+ when 3
17
+ 'rd'
18
+ else
19
+ 'th'
20
+ end
21
+ end
22
+
23
+ def self.today
24
+ "Today is the #{days_since_march_first}#{ordinal_indicator(days_since_march_first)} day of March."
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: days_of_march
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Avner Shanan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-07-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Pandemics are weird
14
+ email: ashanan@gmail.com
15
+ executables:
16
+ - days_of_march
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/days_of_march
21
+ - lib/days_of_march.rb
22
+ homepage: https://rubygems.org/gems/days_of_march
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.0.1
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Calculates what day of march we're on
45
+ test_files: []