waaah 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fef01f85295057015d4c459d8834b42887af7d0917a8b42f70e6c97530ecb773
4
+ data.tar.gz: 390288eaf86e6521736c73206a6902b9157be13dde24c957ba6fb466b13f5309
5
+ SHA512:
6
+ metadata.gz: df620753644d4972c3bb3f4265104b9563a9094448bf62312f3db8ecd99cffd96827eccd9b91e4c843c8929cb99f38dd02424ef8ec5947d35df4b4551e411ba3
7
+ data.tar.gz: 5657abc2c07338f15ce65f9a8bb07ca97a524f6f44a591b1a301f529a903e9a161fc31fbd96cef21e0138d698edc5f0d84dfe9a607dd467108601596b8c5ecda
data/bin/waaah ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require "waaah"
3
+
4
+ Waaah::CLI.run(ARGV)
data/lib/waaah/cli.rb ADDED
@@ -0,0 +1,47 @@
1
+ require 'optparse'
2
+ require 'date'
3
+
4
+ module Waaah
5
+ class CLI
6
+ def self.run(argv)
7
+ options = {}
8
+
9
+ OptionParser.new do |opts|
10
+ opts.on('-h' '--help', 'Command execution example: waaah -d YYYY-MM-DD') do |boolean|
11
+ puts ops
12
+ exit
13
+ end
14
+
15
+ opts.on("-d", "--date DATE", "Specify the due date(ex: 2025-01-01)") do |date|
16
+ begin
17
+ options[:due_date] = Date.parse(date)
18
+ rescue ArgumentError
19
+ puts 'Error: The date format is not correct.(ex: 2025-01-01)'
20
+ exit 1
21
+ end
22
+ end
23
+ end.parse!
24
+
25
+ unless options[:due_date]
26
+ warn "Error: The specification of the due date is required."
27
+ exit 1
28
+ end
29
+
30
+ due_date = options[:due_date]
31
+ today = Date.today
32
+ start_date = due_date - 280
33
+
34
+ puts '----------------------'
35
+ puts "Due date: #{due_date}"
36
+ puts '----------------------'
37
+ puts "Pregnancy start date: #{start_date}"
38
+
39
+ (1..10).each do |month|
40
+ month_start_date = start_date + (month * 4 * 7)
41
+ month_end_date = month_start_date + 28
42
+ now = ' *' if (month_start_date..month_end_date).cover?(today)
43
+ puts "#{month} month of pregnancy: #{month_start_date}#{now}"
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Waaah
4
+ VERSION = "0.1.0"
5
+ end
data/lib/waaah.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "waaah/cli"
2
+
3
+ module Waaah
4
+
5
+ end
metadata ADDED
@@ -0,0 +1,42 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: waaah
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - tadaaki
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-05-25 00:00:00.000000000 Z
11
+ dependencies: []
12
+ executables:
13
+ - waaah
14
+ extensions: []
15
+ extra_rdoc_files: []
16
+ files:
17
+ - bin/waaah
18
+ - lib/waaah.rb
19
+ - lib/waaah/cli.rb
20
+ - lib/waaah/version.rb
21
+ homepage: https://example.com
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.6.2
40
+ specification_version: 4
41
+ summary: Calculate pregnancy months from due date
42
+ test_files: []