jpdate 0.2.1 → 0.2.2
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 +4 -4
- data/bin/jcal +7 -10
- data/lib/jpdate/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 573d09d7c3f6c9bc501fa9e8e9031f3827efc3556056960628af0d44231b83ce
|
4
|
+
data.tar.gz: 33116adb481bbe670f4c19436621f2c864646261cbb112817213fc1dfcc79921
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce83f54a80cb9dc1a6c1d94a04dfa576bb3f4c7578013575e1cdf15256f7aedc79a72867568a2a3f1364e1abcd6b5114010c0a39055be6519b50d91654d62814
|
7
|
+
data.tar.gz: f4d5fe3c15d05c9dd415b5b4bbf1c034e3ed62fc04f74986db2d6ee906f6780b23618e04fb17d8c7e4fd3408329f51fc5aa1c2599eab1ec4827e45165f839fe1
|
data/bin/jcal
CHANGED
@@ -31,6 +31,7 @@ module Jcal
|
|
31
31
|
module_function
|
32
32
|
|
33
33
|
def render_matrix(y, m)
|
34
|
+
m = 12 if m == 0
|
34
35
|
title = (sprintf("#{JPDate::Era.name_year(y, m).join('/')} %4d年 %2d月", y, m)).center_ja(16 * 7)
|
35
36
|
week_names = WEEK_JA.map {|s| s.rjust_ja(16)}
|
36
37
|
week_names[0] = "\e[31m#{week_names[0]}\e[0m"
|
@@ -81,13 +82,9 @@ module Jcal
|
|
81
82
|
end
|
82
83
|
|
83
84
|
def matrix(base_year, start_month, end_month=start_month)
|
84
|
-
|
85
|
-
start_month
|
86
|
-
|
87
|
-
(start_month..end_month).each {|i| render_matrix(base_year , i)}
|
88
|
-
else
|
89
|
-
(start_month..12 ).each {|i| render_matrix(base_year , i)}
|
90
|
-
( 1..end_month).each {|i| render_matrix(base_year + 1, i)}
|
85
|
+
end_month += 12 if start_month > end_month
|
86
|
+
(start_month..end_month).each do |i|
|
87
|
+
render_matrix(base_year + (i / 12.0).ceil - 1, i % 12)
|
91
88
|
end
|
92
89
|
end
|
93
90
|
|
@@ -104,8 +101,8 @@ options = {}
|
|
104
101
|
OptionParser.new do |opt|
|
105
102
|
opt.banner = 'Usage: jcal [options] [yyyy|mm] [yyyy|mm] [yyyy|mm]'
|
106
103
|
opt.separator('')
|
107
|
-
opt.on('-y[NUM]', '
|
108
|
-
opt.on('-m[NUM]', 'Show NUM months.
|
104
|
+
opt.on('-y[NUM]', 'Show NUM years.(0-10)') {|v| options[:years] = v.to_i}
|
105
|
+
opt.on('-m[NUM]', 'Show NUM months.') {|v| options[:months] = v.to_i}
|
109
106
|
opt.on('-e' , 'List with the name of Japanese era.') {|v| options[:era] = v}
|
110
107
|
opt.separator('')
|
111
108
|
opt.on('Example:',
|
@@ -119,6 +116,7 @@ OptionParser.new do |opt|
|
|
119
116
|
' jcal -m # Show monthly calendar from last month to next month.',
|
120
117
|
' jcal -m6 2010 1 # Show monthly calendar from Jan.2010 to Jun.2010.',
|
121
118
|
' jcal 2010 2 8 # Show monthly calendar from Feb.2010 to Aug.2010.',
|
119
|
+
' jcal --version=JPDate # Show version of JPDate.',
|
122
120
|
)
|
123
121
|
begin
|
124
122
|
opt.parse!(ARGV)
|
@@ -141,7 +139,6 @@ m = [m[0] , m[0] + options[:months] - 1] if options.key?(:months) && option
|
|
141
139
|
(y[0] = options[:years]; options[:years] = 0) if options.key?(:years) && options[:years] >= 1900 # -y西暦なら、西暦と解釈
|
142
140
|
m = [1, 12] if options.key?(:years) && options[:years] <= 1 # -y指定期間が1年以下は、12カ月分表示
|
143
141
|
options[:years] ||= (y[1] - y[0]).abs + 1 if y.size == 2 && (options.empty? || options[:era]) # 西暦2個・月0個・オプションなしは、-yに期間を追加
|
144
|
-
|
145
142
|
if options.key?(:years) && options[:years] >= 2
|
146
143
|
Jcal::list(y.min, options[:years], options[:era])
|
147
144
|
else
|
data/lib/jpdate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jpdate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zariganitosh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|