zakuro 0.4.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -3
- data/VERSION +1 -0
- data/doc/operation/csv/month.csv +21 -0
- data/doc/operation/operation.xlsx +0 -0
- data/lib/zakuro/calculation/base/gengou.rb +82 -0
- data/lib/zakuro/calculation/base/linear_gengou.rb +76 -0
- data/lib/zakuro/calculation/base/operated_year.rb +5 -15
- data/lib/zakuro/calculation/base/year.rb +26 -14
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +0 -13
- data/lib/zakuro/calculation/era/gengou/internal/connector.rb +107 -0
- data/lib/zakuro/calculation/era/gengou/internal/counter.rb +214 -0
- data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +104 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/list.rb +244 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/range.rb +193 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +42 -0
- data/lib/zakuro/calculation/era/gengou/scroll.rb +211 -0
- data/lib/zakuro/calculation/era/version/internal/crawler.rb +51 -0
- data/lib/zakuro/calculation/era/version/internal/range.rb +39 -0
- data/lib/zakuro/calculation/era/version/version.rb +24 -0
- data/lib/zakuro/calculation/monthly/first_day.rb +3 -2
- data/lib/zakuro/calculation/monthly/month.rb +49 -2
- data/lib/zakuro/calculation/monthly/operated_month.rb +2 -2
- data/lib/zakuro/calculation/range/full_range.rb +68 -107
- data/lib/zakuro/calculation/range/operated_range.rb +13 -9
- data/lib/zakuro/calculation/range/operated_solar_terms.rb +36 -17
- data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +54 -0
- data/lib/zakuro/calculation/range/transfer/year_boundary.rb +25 -21
- data/lib/zakuro/calculation/specifier/internal/month.rb +84 -0
- data/lib/zakuro/calculation/specifier/multiple_day.rb +162 -0
- data/lib/zakuro/calculation/specifier/single_day.rb +15 -37
- data/lib/zakuro/calculation/summary/internal/operation.rb +98 -0
- data/lib/zakuro/calculation/summary/range.rb +120 -0
- data/lib/zakuro/calculation/summary/single.rb +45 -64
- data/lib/zakuro/condition.rb +14 -0
- data/lib/zakuro/era/japan/calendar.rb +133 -0
- data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +106 -0
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +165 -0
- data/lib/zakuro/era/japan/gengou/alignment/line.rb +156 -0
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +184 -0
- data/lib/zakuro/era/japan/gengou/alignment.rb +42 -0
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +242 -0
- data/lib/zakuro/era/japan/gengou/resource/type.rb +292 -0
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +346 -0
- data/lib/zakuro/era/japan/gengou/resource/yaml/set-001-until-south.yaml +1870 -0
- data/lib/zakuro/era/japan/gengou/resource/yaml/set-002-from-north.yaml +810 -0
- data/lib/zakuro/era/japan/gengou/resource/yaml/set-003-modern.yaml +50 -0
- data/lib/zakuro/era/japan/gengou/resource.rb +32 -0
- data/lib/zakuro/era/japan/gengou.rb +35 -74
- data/lib/zakuro/era/japan/version.rb +151 -0
- data/lib/zakuro/era/{western.rb → western/calendar.rb} +0 -0
- data/lib/zakuro/merchant.rb +50 -3
- data/lib/zakuro/operation/month/parser.rb +1 -1
- data/lib/zakuro/operation/month/type.rb +1 -1
- data/lib/zakuro/operation/month/validator.rb +2 -2
- data/lib/zakuro/operation/yaml/month.yaml +672 -0
- data/lib/zakuro/output/response.rb +5 -5
- data/lib/zakuro/result/result.rb +17 -0
- data/lib/zakuro/tools/typeconv.rb +38 -0
- data/lib/zakuro/tools/typeof.rb +4 -1
- data/lib/zakuro/version/context.rb +24 -3
- data/lib/zakuro/version/daien/cycle/remainder.rb +26 -0
- data/lib/zakuro/version/daien/daien.rb +1 -26
- data/lib/zakuro/version/daien/stella/solar/average.rb +2 -2
- data/lib/zakuro/version/genka/const/number.rb +43 -0
- data/lib/zakuro/version/genka/const/remainder.rb +33 -0
- data/lib/zakuro/version/genka/cycle/remainder.rb +92 -0
- data/lib/zakuro/version/genka/cycle/solar_term.rb +34 -0
- data/lib/zakuro/version/genka/genka.rb +1 -9
- data/lib/zakuro/version/genka/monthly/lunar_phase.rb +95 -0
- data/lib/zakuro/version/genka/range/annual_range.rb +77 -0
- data/lib/zakuro/version/genka/stella/origin/first_term.rb +55 -0
- data/lib/zakuro/version/genka/stella/origin/january.rb +49 -0
- data/lib/zakuro/version/genka/stella/solar/average.rb +41 -0
- data/lib/zakuro/version/gihou/cycle/remainder.rb +26 -0
- data/lib/zakuro/version/gihou/gihou.rb +1 -30
- data/lib/zakuro/version/gihou/stella/solar/average.rb +2 -2
- data/lib/zakuro/version/gregorio/gregorio.rb +1 -9
- data/lib/zakuro/version/houryaku/houryaku.rb +1 -9
- data/lib/zakuro/version/joukyou/joukyou.rb +1 -9
- data/lib/zakuro/version/kansei/kansei.rb +1 -9
- data/lib/zakuro/version/senmyou/README.md +11 -7
- data/lib/zakuro/version/senmyou/cycle/remainder.rb +26 -0
- data/lib/zakuro/version/senmyou/senmyou.rb +1 -30
- data/lib/zakuro/version/senmyou/stella/solar/average.rb +2 -2
- data/lib/zakuro/version/tenpou/tenpou.rb +1 -9
- data/lib/zakuro/version/version_class_resolver.rb +4 -0
- data/zakuro.gemspec +1 -3
- metadata +45 -16
- data/lib/zakuro/calculation/base/multi_gengou.rb +0 -101
- data/lib/zakuro/calculation/base/multi_gengou_roller.rb +0 -218
- data/lib/zakuro/calculation/range/transfer/western_date_allocation.rb +0 -82
- data/lib/zakuro/era/japan/gengou/parser.rb +0 -167
- data/lib/zakuro/era/japan/gengou/type.rb +0 -178
- data/lib/zakuro/era/japan/gengou/validator.rb +0 -236
- data/lib/zakuro/era/japan/reki.rb +0 -91
- data/lib/zakuro/era/japan/yaml/set-001-until-south.yaml +0 -1121
- data/lib/zakuro/era/japan/yaml/set-002-from-north.yaml +0 -485
- data/lib/zakuro/era/japan/yaml/set-003-modern.yaml +0 -28
- data/lib/zakuro/version/abstract_version.rb +0 -29
- data/lib/zakuro/version.rb +0 -7
- data/lib/zakuro/version_factory.rb +0 -59
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../calculation/stella/solar/abstract_average'
|
4
|
+
|
5
|
+
require_relative '../../const/remainder'
|
6
|
+
|
7
|
+
require_relative '../../cycle/solar_term'
|
8
|
+
|
9
|
+
# :nodoc:
|
10
|
+
module Zakuro
|
11
|
+
# :nodoc:
|
12
|
+
module Genka
|
13
|
+
# :nodoc:
|
14
|
+
module Solar
|
15
|
+
#
|
16
|
+
# Average 平気(太陽軌道平均)
|
17
|
+
#
|
18
|
+
class Average < Calculation::Solar::AbstractAverage
|
19
|
+
#
|
20
|
+
# 初期化
|
21
|
+
#
|
22
|
+
# @param [Integer] western_year 西暦年
|
23
|
+
#
|
24
|
+
def initialize(solar_term:)
|
25
|
+
super(solar_term: solar_term)
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# 冬至から数えた1年データの月ごとに二十四節気を割り当てる
|
30
|
+
#
|
31
|
+
# @param [Array<Month>] annual_range 1年データ
|
32
|
+
#
|
33
|
+
# @return [Array<Month>] 1年データ
|
34
|
+
#
|
35
|
+
def set(annual_range:)
|
36
|
+
super(annual_range: annual_range)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -29,6 +29,19 @@ module Zakuro
|
|
29
29
|
super(base_day: Const::Number::Cycle::DAY, base_mitune: MINUTE,
|
30
30
|
day: day, minute: minute, second: second, total: total)
|
31
31
|
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# 特定の文字フォーマットにして出力する
|
35
|
+
#
|
36
|
+
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
37
|
+
#
|
38
|
+
# @return [String] フォーマットした結果
|
39
|
+
#
|
40
|
+
def format(form: '%d-%d')
|
41
|
+
return '' if invalid?
|
42
|
+
|
43
|
+
super(form, @day, @minute, @second)
|
44
|
+
end
|
32
45
|
end
|
33
46
|
|
34
47
|
#
|
@@ -50,6 +63,19 @@ module Zakuro
|
|
50
63
|
super(base_day: Const::Number::Cycle::DAY, base_mitune: MINUTE,
|
51
64
|
day: day, minute: minute, second: second, total: total)
|
52
65
|
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# 特定の文字フォーマットにして出力する
|
69
|
+
#
|
70
|
+
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
71
|
+
#
|
72
|
+
# @return [String] フォーマットした結果
|
73
|
+
#
|
74
|
+
def format(form: '%d-%d')
|
75
|
+
return '' if invalid?
|
76
|
+
|
77
|
+
super(form, @day, @minute, @second)
|
78
|
+
end
|
53
79
|
end
|
54
80
|
end
|
55
81
|
end
|
@@ -1,40 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'date'
|
4
|
-
require_relative '../../era/western'
|
5
|
-
require_relative '../abstract_version'
|
6
|
-
require_relative '../context'
|
7
|
-
require_relative '../../calculation/summary/single'
|
8
|
-
|
9
3
|
# :nodoc:
|
10
4
|
module Zakuro
|
11
5
|
#
|
12
6
|
# Gihou 儀鳳暦
|
13
7
|
#
|
14
8
|
module Gihou
|
15
|
-
#
|
16
|
-
# Gateway アクセサメソッド群
|
17
|
-
#
|
18
|
-
class Gateway < AbstractVersion
|
19
|
-
# @return [True] リリースあり
|
20
|
-
RELEASE = true
|
21
|
-
|
22
|
-
# @return [String] 暦クラス名
|
23
|
-
VERSION_NAME = 'Gihou'
|
24
|
-
|
25
|
-
#
|
26
|
-
# 西暦日から和暦日に変換する
|
27
|
-
#
|
28
|
-
# @param [Date] western_date 西暦日
|
29
|
-
#
|
30
|
-
# @return [Result::Single] 和暦日
|
31
|
-
#
|
32
|
-
def self.to_japan_date(western_date:)
|
33
|
-
date = Western::Calendar.create(date: western_date)
|
34
|
-
|
35
|
-
context = Context.new(version_name: VERSION_NAME)
|
36
|
-
Calculation::Summary::Single.get(context: context, date: date)
|
37
|
-
end
|
38
|
-
end
|
9
|
+
# none
|
39
10
|
end
|
40
11
|
end
|
@@ -55,7 +55,7 @@ module Zakuro
|
|
55
55
|
# 二十四節気(冬至)
|
56
56
|
solar_term = Cycle::SolarTerm.new(index: 0, remainder: winter_solstice)
|
57
57
|
|
58
|
-
first_solar_term_index = Average.
|
58
|
+
first_solar_term_index = Average.calc_first_solar_term_index(western_year: western_year)
|
59
59
|
|
60
60
|
# 対象の二十四節気まで戻す
|
61
61
|
solar_term.prev_by_index(first_solar_term_index)
|
@@ -77,7 +77,7 @@ module Zakuro
|
|
77
77
|
#
|
78
78
|
# @return [Integer] 二十四節気番号
|
79
79
|
#
|
80
|
-
def self.
|
80
|
+
def self.calc_first_solar_term_index(western_year:)
|
81
81
|
# 天正閏余
|
82
82
|
lunar_age = Origin::LunarAge.get(western_year: western_year)
|
83
83
|
|
@@ -1,19 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../abstract_version'
|
4
|
-
|
5
3
|
# :nodoc:
|
6
4
|
module Zakuro
|
7
5
|
#
|
8
6
|
# Gregorio グレゴリオ暦
|
9
7
|
#
|
10
8
|
module Gregorio
|
11
|
-
#
|
12
|
-
# Gateway アクセサメソッド群
|
13
|
-
#
|
14
|
-
class Gateway < AbstractVersion
|
15
|
-
# @return [False] リリースなし
|
16
|
-
RELEASE = false
|
17
|
-
end
|
9
|
+
# none
|
18
10
|
end
|
19
11
|
end
|
@@ -1,19 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../abstract_version'
|
4
|
-
|
5
3
|
# :nodoc:
|
6
4
|
module Zakuro
|
7
5
|
#
|
8
6
|
# Houryaku 宝暦暦
|
9
7
|
#
|
10
8
|
module Houryaku
|
11
|
-
#
|
12
|
-
# Gateway アクセサメソッド群
|
13
|
-
#
|
14
|
-
class Gateway < AbstractVersion
|
15
|
-
# @return [False] リリースなし
|
16
|
-
RELEASE = false
|
17
|
-
end
|
9
|
+
# none
|
18
10
|
end
|
19
11
|
end
|
@@ -1,19 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../abstract_version'
|
4
|
-
|
5
3
|
# :nodoc:
|
6
4
|
module Zakuro
|
7
5
|
#
|
8
6
|
# Joukyou 貞享暦
|
9
7
|
#
|
10
8
|
module Joukyou
|
11
|
-
#
|
12
|
-
# Gateway アクセサメソッド群
|
13
|
-
#
|
14
|
-
class Gateway < AbstractVersion
|
15
|
-
# @return [False] リリースなし
|
16
|
-
RELEASE = false
|
17
|
-
end
|
9
|
+
# none
|
18
10
|
end
|
19
11
|
end
|
@@ -1,19 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../abstract_version'
|
4
|
-
|
5
3
|
# :nodoc:
|
6
4
|
module Zakuro
|
7
5
|
#
|
8
6
|
# Kansei 寛政暦
|
9
7
|
#
|
10
8
|
module Kansei
|
11
|
-
#
|
12
|
-
# Gateway アクセサメソッド群
|
13
|
-
#
|
14
|
-
class Gateway < AbstractVersion
|
15
|
-
# @return [False] リリースなし
|
16
|
-
RELEASE = false
|
17
|
-
end
|
9
|
+
# none
|
18
10
|
end
|
19
11
|
end
|
@@ -94,21 +94,25 @@
|
|
94
94
|
|
95
95
|
計算の多くはそれぞれの暦に依存するが、まずは共通の計算部分を列挙する
|
96
96
|
|
97
|
-
###
|
97
|
+
### 元号の求め方
|
98
98
|
|
99
|
-
|
99
|
+
元慶(877-6-1 ~ 885-3-10)をもとに考える
|
100
100
|
|
101
|
-
|
101
|
+
元号開始年が存在する元号年(877)から、次の元号の開始年(885) + 1 までを和暦計算する。これをAとする
|
102
102
|
|
103
|
-
|
103
|
+
元号のはじまりは固定値のため、西暦開始日と、それに対応する和暦開始日を持つ(例: 元慶01年04月16日 = 877-6-1)
|
104
104
|
|
105
|
-
|
105
|
+
この和暦開始日は必ずAの1年目に存在するため、1年目の和暦日を特定し、その日と西暦開始日を関連付ける
|
106
106
|
|
107
|
-
|
107
|
+
もし元慶2年以降を計算したい場合は、Aの西暦開始日から該当年月日までを加算で求める
|
108
|
+
|
109
|
+
具体的には、和暦上の月の大小(29日 or 30日)を用いた加算となる
|
110
|
+
|
111
|
+
念のため補足するが、西暦(太陽暦)のように1年あたりの日数は一定しない
|
108
112
|
|
109
113
|
平年(353/354/355/356)または閏年(383/384/385)のパターンがあり、月の大小(29/30)や閏月(中気のない月)の有無で変動する
|
110
114
|
|
111
|
-
|
115
|
+
したがって、2年目以降を加算なしに特定することはできない
|
112
116
|
|
113
117
|
### 南北朝について
|
114
118
|
|
@@ -29,6 +29,19 @@ module Zakuro
|
|
29
29
|
super(base_day: Const::Number::Cycle::DAY, base_mitune: MINUTE,
|
30
30
|
day: day, minute: minute, second: second, total: total)
|
31
31
|
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# 特定の文字フォーマットにして出力する
|
35
|
+
#
|
36
|
+
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
37
|
+
#
|
38
|
+
# @return [String] フォーマットした結果
|
39
|
+
#
|
40
|
+
def format(form: '%d-%d')
|
41
|
+
return '' if invalid?
|
42
|
+
|
43
|
+
super(form, @day, @minute, @second)
|
44
|
+
end
|
32
45
|
end
|
33
46
|
|
34
47
|
#
|
@@ -50,6 +63,19 @@ module Zakuro
|
|
50
63
|
super(base_day: Const::Number::Cycle::DAY, base_mitune: MINUTE,
|
51
64
|
day: day, minute: minute, second: second, total: total)
|
52
65
|
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# 特定の文字フォーマットにして出力する
|
69
|
+
#
|
70
|
+
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
71
|
+
#
|
72
|
+
# @return [String] フォーマットした結果
|
73
|
+
#
|
74
|
+
def format(form: '%d-%d')
|
75
|
+
return '' if invalid?
|
76
|
+
|
77
|
+
super(form, @day, @minute, @second)
|
78
|
+
end
|
53
79
|
end
|
54
80
|
end
|
55
81
|
end
|
@@ -1,40 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'date'
|
4
|
-
require_relative '../../era/western'
|
5
|
-
require_relative '../abstract_version'
|
6
|
-
require_relative '../context'
|
7
|
-
require_relative '../../calculation/summary/single'
|
8
|
-
|
9
3
|
# :nodoc:
|
10
4
|
module Zakuro
|
11
5
|
#
|
12
6
|
# Senmyou 宣明暦
|
13
7
|
#
|
14
8
|
module Senmyou
|
15
|
-
#
|
16
|
-
# Gateway アクセサメソッド群
|
17
|
-
#
|
18
|
-
class Gateway < AbstractVersion
|
19
|
-
# @return [True] リリースあり
|
20
|
-
RELEASE = true
|
21
|
-
|
22
|
-
# @return [String] 暦クラス名
|
23
|
-
VERSION_NAME = 'Senmyou'
|
24
|
-
|
25
|
-
#
|
26
|
-
# 西暦日から和暦日に変換する
|
27
|
-
#
|
28
|
-
# @param [Date] western_date 西暦日
|
29
|
-
#
|
30
|
-
# @return [Result::Single] 和暦日
|
31
|
-
#
|
32
|
-
def self.to_japan_date(western_date:)
|
33
|
-
date = Western::Calendar.create(date: western_date)
|
34
|
-
|
35
|
-
context = Context.new(version_name: VERSION_NAME)
|
36
|
-
Calculation::Summary::Single.get(context: context, date: date)
|
37
|
-
end
|
38
|
-
end
|
9
|
+
# none
|
39
10
|
end
|
40
11
|
end
|
@@ -55,7 +55,7 @@ module Zakuro
|
|
55
55
|
# 二十四節気(冬至)
|
56
56
|
solar_term = Cycle::SolarTerm.new(index: 0, remainder: winter_solstice)
|
57
57
|
|
58
|
-
first_solar_term_index = Average.
|
58
|
+
first_solar_term_index = Average.calc_first_solar_term_index(western_year: western_year)
|
59
59
|
|
60
60
|
# 対象の二十四節気まで戻す
|
61
61
|
solar_term.prev_by_index(first_solar_term_index)
|
@@ -77,7 +77,7 @@ module Zakuro
|
|
77
77
|
#
|
78
78
|
# @return [Integer] 二十四節気番号
|
79
79
|
#
|
80
|
-
def self.
|
80
|
+
def self.calc_first_solar_term_index(western_year:)
|
81
81
|
# 天正閏余
|
82
82
|
lunar_age = Origin::LunarAge.get(western_year: western_year)
|
83
83
|
|
@@ -1,19 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../abstract_version'
|
4
|
-
|
5
3
|
# :nodoc:
|
6
4
|
module Zakuro
|
7
5
|
#
|
8
6
|
# Tenpou 天保暦
|
9
7
|
#
|
10
8
|
module Tenpou
|
11
|
-
#
|
12
|
-
# Gateway アクセサメソッド群
|
13
|
-
#
|
14
|
-
class Gateway < AbstractVersion
|
15
|
-
# @return [False] リリースなし
|
16
|
-
RELEASE = false
|
17
|
-
end
|
9
|
+
# none
|
18
10
|
end
|
19
11
|
end
|
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative './genka/cycle/remainder'
|
4
|
+
require_relative './genka/cycle/solar_term'
|
5
|
+
require_relative './genka/range/annual_range'
|
6
|
+
|
3
7
|
require_relative './gihou/cycle/remainder'
|
4
8
|
require_relative './gihou/cycle/solar_term'
|
5
9
|
require_relative './gihou/range/annual_range'
|
data/zakuro.gemspec
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'lib/zakuro/version'
|
4
|
-
|
5
3
|
Gem::Specification.new do |spec|
|
6
4
|
spec.name = 'zakuro'
|
7
|
-
spec.version =
|
5
|
+
spec.version = File.read(File.expand_path('./VERSION', __dir__)).strip
|
8
6
|
spec.authors = ['pldb']
|
9
7
|
spec.email = ['pldb.github@gmail.com']
|
10
8
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zakuro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pldb
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: mainly lunar solar calendar
|
14
14
|
email:
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- Makefile
|
27
27
|
- README.md
|
28
28
|
- Rakefile
|
29
|
+
- VERSION
|
29
30
|
- bin/console
|
30
31
|
- bin/setup
|
31
32
|
- doc/gengou.md
|
@@ -40,13 +41,23 @@ files:
|
|
40
41
|
- images/各月の求め方.png
|
41
42
|
- images/太陽と月.png
|
42
43
|
- lib/zakuro.rb
|
43
|
-
- lib/zakuro/calculation/base/
|
44
|
-
- lib/zakuro/calculation/base/
|
44
|
+
- lib/zakuro/calculation/base/gengou.rb
|
45
|
+
- lib/zakuro/calculation/base/linear_gengou.rb
|
45
46
|
- lib/zakuro/calculation/base/operated_year.rb
|
46
47
|
- lib/zakuro/calculation/base/year.rb
|
47
48
|
- lib/zakuro/calculation/cycle/abstract_remainder.rb
|
48
49
|
- lib/zakuro/calculation/cycle/abstract_solar_term.rb
|
49
50
|
- lib/zakuro/calculation/cycle/zodiac.rb
|
51
|
+
- lib/zakuro/calculation/era/gengou/internal/connector.rb
|
52
|
+
- lib/zakuro/calculation/era/gengou/internal/counter.rb
|
53
|
+
- lib/zakuro/calculation/era/gengou/internal/publisher.rb
|
54
|
+
- lib/zakuro/calculation/era/gengou/internal/reserve.rb
|
55
|
+
- lib/zakuro/calculation/era/gengou/internal/reserve/list.rb
|
56
|
+
- lib/zakuro/calculation/era/gengou/internal/reserve/range.rb
|
57
|
+
- lib/zakuro/calculation/era/gengou/scroll.rb
|
58
|
+
- lib/zakuro/calculation/era/version/internal/crawler.rb
|
59
|
+
- lib/zakuro/calculation/era/version/internal/range.rb
|
60
|
+
- lib/zakuro/calculation/era/version/version.rb
|
50
61
|
- lib/zakuro/calculation/monthly/abstract_lunar_phase.rb
|
51
62
|
- lib/zakuro/calculation/monthly/first_day.rb
|
52
63
|
- lib/zakuro/calculation/monthly/initialized_month.rb
|
@@ -57,26 +68,37 @@ files:
|
|
57
68
|
- lib/zakuro/calculation/range/medieval_annual_range.rb
|
58
69
|
- lib/zakuro/calculation/range/operated_range.rb
|
59
70
|
- lib/zakuro/calculation/range/operated_solar_terms.rb
|
60
|
-
- lib/zakuro/calculation/range/transfer/
|
71
|
+
- lib/zakuro/calculation/range/transfer/gengou_scroller.rb
|
61
72
|
- lib/zakuro/calculation/range/transfer/year_boundary.rb
|
73
|
+
- lib/zakuro/calculation/specifier/internal/month.rb
|
74
|
+
- lib/zakuro/calculation/specifier/multiple_day.rb
|
62
75
|
- lib/zakuro/calculation/specifier/single_day.rb
|
63
76
|
- lib/zakuro/calculation/stella/lunar/abstract_location.rb
|
64
77
|
- lib/zakuro/calculation/stella/lunar/choukei_value.rb
|
65
78
|
- lib/zakuro/calculation/stella/solar/abstract_average.rb
|
66
79
|
- lib/zakuro/calculation/stella/solar/abstract_location.rb
|
67
80
|
- lib/zakuro/calculation/stella/solar/choukei_value.rb
|
81
|
+
- lib/zakuro/calculation/summary/internal/operation.rb
|
82
|
+
- lib/zakuro/calculation/summary/range.rb
|
68
83
|
- lib/zakuro/calculation/summary/single.rb
|
69
84
|
- lib/zakuro/calculation/type/old_float.rb
|
70
85
|
- lib/zakuro/condition.rb
|
86
|
+
- lib/zakuro/era/japan/calendar.rb
|
71
87
|
- lib/zakuro/era/japan/gengou.rb
|
72
|
-
- lib/zakuro/era/japan/gengou/
|
73
|
-
- lib/zakuro/era/japan/gengou/
|
74
|
-
- lib/zakuro/era/japan/gengou/
|
75
|
-
- lib/zakuro/era/japan/
|
76
|
-
- lib/zakuro/era/japan/
|
77
|
-
- lib/zakuro/era/japan/
|
78
|
-
- lib/zakuro/era/japan/
|
79
|
-
- lib/zakuro/era/
|
88
|
+
- lib/zakuro/era/japan/gengou/alignment.rb
|
89
|
+
- lib/zakuro/era/japan/gengou/alignment/aligner.rb
|
90
|
+
- lib/zakuro/era/japan/gengou/alignment/division.rb
|
91
|
+
- lib/zakuro/era/japan/gengou/alignment/line.rb
|
92
|
+
- lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb
|
93
|
+
- lib/zakuro/era/japan/gengou/resource.rb
|
94
|
+
- lib/zakuro/era/japan/gengou/resource/parser.rb
|
95
|
+
- lib/zakuro/era/japan/gengou/resource/type.rb
|
96
|
+
- lib/zakuro/era/japan/gengou/resource/validator.rb
|
97
|
+
- lib/zakuro/era/japan/gengou/resource/yaml/set-001-until-south.yaml
|
98
|
+
- lib/zakuro/era/japan/gengou/resource/yaml/set-002-from-north.yaml
|
99
|
+
- lib/zakuro/era/japan/gengou/resource/yaml/set-003-modern.yaml
|
100
|
+
- lib/zakuro/era/japan/version.rb
|
101
|
+
- lib/zakuro/era/western/calendar.rb
|
80
102
|
- lib/zakuro/merchant.rb
|
81
103
|
- lib/zakuro/operation/month/parser.rb
|
82
104
|
- lib/zakuro/operation/month/type.rb
|
@@ -91,9 +113,8 @@ files:
|
|
91
113
|
- lib/zakuro/result/operation.rb
|
92
114
|
- lib/zakuro/result/result.rb
|
93
115
|
- lib/zakuro/tools/stringifier.rb
|
116
|
+
- lib/zakuro/tools/typeconv.rb
|
94
117
|
- lib/zakuro/tools/typeof.rb
|
95
|
-
- lib/zakuro/version.rb
|
96
|
-
- lib/zakuro/version/abstract_version.rb
|
97
118
|
- lib/zakuro/version/context.rb
|
98
119
|
- lib/zakuro/version/daien/const/number.rb
|
99
120
|
- lib/zakuro/version/daien/const/remainder.rb
|
@@ -114,7 +135,16 @@ files:
|
|
114
135
|
- lib/zakuro/version/daien/stella/solar/interval.rb
|
115
136
|
- lib/zakuro/version/daien/stella/solar/location.rb
|
116
137
|
- lib/zakuro/version/daien/stella/solar/value.rb
|
138
|
+
- lib/zakuro/version/genka/const/number.rb
|
139
|
+
- lib/zakuro/version/genka/const/remainder.rb
|
140
|
+
- lib/zakuro/version/genka/cycle/remainder.rb
|
141
|
+
- lib/zakuro/version/genka/cycle/solar_term.rb
|
117
142
|
- lib/zakuro/version/genka/genka.rb
|
143
|
+
- lib/zakuro/version/genka/monthly/lunar_phase.rb
|
144
|
+
- lib/zakuro/version/genka/range/annual_range.rb
|
145
|
+
- lib/zakuro/version/genka/stella/origin/first_term.rb
|
146
|
+
- lib/zakuro/version/genka/stella/origin/january.rb
|
147
|
+
- lib/zakuro/version/genka/stella/solar/average.rb
|
118
148
|
- lib/zakuro/version/gihou/const/number.rb
|
119
149
|
- lib/zakuro/version/gihou/const/remainder.rb
|
120
150
|
- lib/zakuro/version/gihou/cycle/remainder.rb
|
@@ -160,7 +190,6 @@ files:
|
|
160
190
|
- lib/zakuro/version/senmyou/stella/solar/value.rb
|
161
191
|
- lib/zakuro/version/tenpou/tenpou.rb
|
162
192
|
- lib/zakuro/version/version_class_resolver.rb
|
163
|
-
- lib/zakuro/version_factory.rb
|
164
193
|
- zakuro.gemspec
|
165
194
|
homepage: https://github.com/pldb/zakuro
|
166
195
|
licenses:
|
@@ -1,101 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../era/japan/gengou'
|
4
|
-
require_relative '../../era/western'
|
5
|
-
|
6
|
-
# :nodoc:
|
7
|
-
module Zakuro
|
8
|
-
# :nodoc:
|
9
|
-
module Calculation
|
10
|
-
# :nodoc:
|
11
|
-
module Base
|
12
|
-
#
|
13
|
-
# MultiGengou 複数元号
|
14
|
-
#
|
15
|
-
class MultiGengou
|
16
|
-
# @return [Japan::Gengou] 元号(1行目)
|
17
|
-
attr_reader :first_line
|
18
|
-
# @return [Japan::Gengou] 元号(2行目)
|
19
|
-
attr_reader :second_line
|
20
|
-
# @return [Western::Calendar] 元旦
|
21
|
-
attr_reader :new_year_date
|
22
|
-
|
23
|
-
def initialize(first_line: Japan::Gengou.new, second_line: Japan::Gengou.new,
|
24
|
-
new_year_date: Western::Calendar.new)
|
25
|
-
@first_line = first_line
|
26
|
-
@second_line = second_line
|
27
|
-
@new_year_date = new_year_date
|
28
|
-
end
|
29
|
-
|
30
|
-
# :reek:TooManyStatements { max_statements: 7 }
|
31
|
-
|
32
|
-
#
|
33
|
-
# 改元する
|
34
|
-
#
|
35
|
-
# @param [Japan::Gengou] first_line 元号(1行目)
|
36
|
-
# @param [Japan::Gengou] second_line 元号(2行目)
|
37
|
-
#
|
38
|
-
# @return [MultiGengou] 自身
|
39
|
-
#
|
40
|
-
def transfer(first_line: Japan::Gengou.new, second_line: Japan::Gengou.new)
|
41
|
-
cloned_first_line = first_line.clone
|
42
|
-
cloned_second_line = second_line.clone
|
43
|
-
|
44
|
-
if integrated?(first_line: cloned_first_line, second_line: cloned_second_line)
|
45
|
-
@first_line = @second_line.clone
|
46
|
-
@second_line = cloned_second_line
|
47
|
-
end
|
48
|
-
|
49
|
-
@first_line = cloned_first_line if @first_line.name != first_line.name
|
50
|
-
@second_line = cloned_second_line if @second_line.name != second_line.name
|
51
|
-
|
52
|
-
self
|
53
|
-
end
|
54
|
-
|
55
|
-
#
|
56
|
-
# 次年にする
|
57
|
-
#
|
58
|
-
# @param [Japan::Gengou] first_line 元号(1行目)
|
59
|
-
# @param [Japan::Gengou] second_line 元号(2行目)
|
60
|
-
#
|
61
|
-
# @return [MultiGengou] 自身
|
62
|
-
#
|
63
|
-
def next_year
|
64
|
-
@first_line.next_year
|
65
|
-
@second_line.next_year
|
66
|
-
|
67
|
-
self
|
68
|
-
end
|
69
|
-
|
70
|
-
#
|
71
|
-
# ディープコピー
|
72
|
-
#
|
73
|
-
# @param [MultiGengou] obj 自身
|
74
|
-
#
|
75
|
-
def initialize_copy(obj)
|
76
|
-
@first_line = obj.first_line.clone
|
77
|
-
@second_line = obj.second_line.clone
|
78
|
-
end
|
79
|
-
|
80
|
-
private
|
81
|
-
|
82
|
-
#
|
83
|
-
# 複数元号を統一するかどうか
|
84
|
-
#
|
85
|
-
# @param [Japan::Gengou] first_line 元号(1行目)
|
86
|
-
# @param [Japan::Gengou] second_line 元号(2行目)
|
87
|
-
#
|
88
|
-
# @return [True] 統一する
|
89
|
-
# @return [False] 統一しない
|
90
|
-
#
|
91
|
-
def integrated?(first_line: Japan::Gengou.new, second_line: Japan::Gengou.new)
|
92
|
-
return false if @second_line.name != first_line.name
|
93
|
-
|
94
|
-
return false unless second_line.invalid?
|
95
|
-
|
96
|
-
true
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|