zakuro 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +3 -0
  3. data/README.md +6 -4
  4. data/VERSION +1 -1
  5. data/doc/operation/transfer.rb +8 -8
  6. data/lib/zakuro/calculation/base/gengou.rb +46 -0
  7. data/lib/zakuro/calculation/era/gengou/{scroll.rb → abstract_scroll.rb} +6 -8
  8. data/lib/zakuro/calculation/era/gengou/dated_scroll.rb +30 -0
  9. data/lib/zakuro/calculation/era/gengou/internal/reserve/{list.rb → abstract_list.rb} +37 -51
  10. data/lib/zakuro/calculation/era/gengou/internal/reserve/{range.rb → abstract_range.rb} +17 -17
  11. data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +48 -0
  12. data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_range.rb +30 -0
  13. data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +158 -0
  14. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +125 -0
  15. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +75 -0
  16. data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +2 -3
  17. data/lib/zakuro/calculation/era/gengou/named_scroll.rb +30 -0
  18. data/lib/zakuro/calculation/monthly/month.rb +39 -0
  19. data/lib/zakuro/calculation/monthly/operated_month.rb +1 -1
  20. data/lib/zakuro/calculation/range/{full_range.rb → abstract_full_range.rb} +5 -4
  21. data/lib/zakuro/calculation/range/{operated_range.rb → abstract_operation_range.rb} +9 -11
  22. data/lib/zakuro/calculation/range/dated_full_range.rb +32 -0
  23. data/lib/zakuro/calculation/range/dated_operation_range.rb +33 -0
  24. data/lib/zakuro/calculation/range/named_full_range.rb +38 -0
  25. data/lib/zakuro/calculation/range/named_operation_range.rb +36 -0
  26. data/lib/zakuro/calculation/range/operated_solar_terms.rb +0 -2
  27. data/lib/zakuro/calculation/{specifier → summary}/internal/month.rb +1 -1
  28. data/lib/zakuro/calculation/summary/japan/range.rb +152 -0
  29. data/lib/zakuro/calculation/summary/japan/single.rb +118 -0
  30. data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +91 -0
  31. data/lib/zakuro/calculation/summary/western/range.rb +124 -0
  32. data/lib/zakuro/calculation/summary/western/single.rb +113 -0
  33. data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +169 -0
  34. data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +93 -0
  35. data/lib/zakuro/condition.rb +1 -2
  36. data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +89 -74
  37. data/lib/zakuro/era/japan/gengou/alignment/division.rb +125 -122
  38. data/lib/zakuro/era/japan/gengou/alignment/line.rb +141 -122
  39. data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +171 -168
  40. data/lib/zakuro/era/japan/gengou/alignment.rb +38 -25
  41. data/lib/zakuro/era/japan/gengou/resource/parser.rb +183 -182
  42. data/lib/zakuro/era/japan/gengou/resource/type.rb +233 -232
  43. data/lib/zakuro/era/japan/gengou/resource/validator.rb +255 -254
  44. data/lib/zakuro/era/japan/gengou/resource.rb +23 -22
  45. data/lib/zakuro/era/japan/gengou.rb +5 -20
  46. data/lib/zakuro/era/western/calendar.rb +9 -9
  47. data/lib/zakuro/exception/case/pattern.rb +35 -0
  48. data/lib/zakuro/exception/case/preset.rb +51 -0
  49. data/lib/zakuro/exception/case/template.rb +48 -0
  50. data/lib/zakuro/exception/cause.rb +28 -0
  51. data/lib/zakuro/exception/exception.rb +37 -0
  52. data/lib/zakuro/exception/zakuro_error.rb +28 -0
  53. data/lib/zakuro/gateway/locale/date.rb +127 -0
  54. data/lib/zakuro/gateway/locale/range.rb +67 -0
  55. data/lib/zakuro/gateway/range.rb +99 -0
  56. data/lib/zakuro/gateway/single.rb +70 -0
  57. data/lib/zakuro/merchant.rb +8 -44
  58. data/lib/zakuro/operation/month/parser.rb +9 -9
  59. data/lib/zakuro/operation/month/type.rb +31 -31
  60. data/lib/zakuro/operation/month/validator.rb +49 -49
  61. data/lib/zakuro/operation/yaml/month.yaml +3736 -3736
  62. data/lib/zakuro/output/logger.rb +17 -3
  63. data/lib/zakuro/result/data/day.rb +43 -0
  64. data/lib/zakuro/result/data/gengou.rb +35 -0
  65. data/lib/zakuro/result/data/month.rb +63 -0
  66. data/lib/zakuro/result/data/single_day.rb +48 -0
  67. data/lib/zakuro/result/data/solar_term.rb +35 -0
  68. data/lib/zakuro/result/data/year.rb +45 -0
  69. data/lib/zakuro/result/operation/month/annotation.rb +40 -0
  70. data/lib/zakuro/result/operation/month/bundle.rb +36 -0
  71. data/lib/zakuro/result/operation/month/history.rb +54 -0
  72. data/lib/zakuro/result/operation/operation.rb +44 -0
  73. data/lib/zakuro/result/result.rb +4 -2
  74. metadata +46 -14
  75. data/lib/zakuro/calculation/specifier/multiple_day.rb +0 -162
  76. data/lib/zakuro/calculation/specifier/single_day.rb +0 -87
  77. data/lib/zakuro/calculation/summary/range.rb +0 -120
  78. data/lib/zakuro/calculation/summary/single.rb +0 -110
  79. data/lib/zakuro/result/data.rb +0 -187
  80. data/lib/zakuro/result/operation.rb +0 -114
@@ -1,162 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../base/year'
4
-
5
- require_relative '../../era/western/calendar'
6
- require_relative '../../output/response'
7
- require_relative '../../output/logger'
8
-
9
- require_relative './internal/month'
10
-
11
- # :nodoc:
12
- module Zakuro
13
- # :nodoc:
14
- module Calculation
15
- # :nodoc:
16
- module Specifier
17
- #
18
- # MultipleDay 複数日検索
19
- #
20
- module MultipleDay
21
- # @return [Output::Logger] ロガー
22
- LOGGER = Output::Logger.new(location: 'specifier')
23
-
24
- #
25
- # 取得する
26
- #
27
- # @param [Array<Base::Year>] years 範囲
28
- # @param [Western::Calendar] start_date 西暦開始日
29
- # @param [Western::Calendar] last_date 西暦終了日
30
- #
31
- # @return [Array<Result::Data::SingleDay>] 期間検索結果(和暦日)
32
- #
33
- def self.get(years: [], start_date: Western::Calendar.new, last_date: Western::Calendar.new)
34
- months = specify(years: years, start_date: start_date, last_date: last_date)
35
-
36
- result = []
37
- months.each do |month|
38
- result |= month.get
39
- end
40
-
41
- result
42
- end
43
-
44
- #
45
- # 年を特定する
46
- #
47
- # @param [Array<Year>] years 範囲
48
- # @param [Western::Calendar] start_date 西暦開始日
49
- # @param [Western::Calendar] last_date 西暦終了日
50
- #
51
- # @return [Array<Month>] 特定月
52
- #
53
- def self.specify(years: [], start_date: Western::Calendar.new,
54
- last_date: Western::Calendar.new)
55
- result = []
56
- years.each do |year|
57
- result |= specify_month(
58
- year: year, start_date: start_date, last_date: last_date
59
- )
60
- end
61
-
62
- result
63
- end
64
- private_class_method :specify
65
-
66
- # :reek:TooManyStatements { max_statements: 7 }
67
-
68
- #
69
- # 月を特定する
70
- #
71
- # @param [Year] year 年
72
- # @param [Western::Calendar] start_date 西暦開始日
73
- # @param [Western::Calendar] last_date 西暦終了日
74
- #
75
- # @return [Month] 対象月
76
- #
77
- def self.specify_month(year:, start_date: Western::Calendar.new,
78
- last_date: Western::Calendar.new)
79
- months = year.months
80
-
81
- specify_months = []
82
- months.each do |month|
83
- next unless include?(month: month, start_date: start_date, last_date: last_date)
84
-
85
- monthly_start_date = month.western_date.clone
86
- monthly_last_date = month.last_date.clone
87
-
88
- monthly_start_date = start_date.clone if start_date > monthly_start_date
89
-
90
- monthly_last_date = last_date.clone if last_date < monthly_last_date
91
-
92
- specify_months.push(
93
- Month.new(year: year, month: month,
94
- start_date: monthly_start_date, last_date: monthly_last_date)
95
- )
96
- end
97
-
98
- specify_months
99
- end
100
- private_class_method :specify_month
101
-
102
- #
103
- # 月が範囲に含まれるか
104
- #
105
- # @param [Monthly::Month] month 月
106
- # @param [Western::Calendar] start_date 西暦開始日
107
- # @param [Western::Calendar] last_date 西暦終了日
108
- #
109
- # @return [True] 含む
110
- # @return [False] 含まない
111
- #
112
- def self.include?(month:, start_date:, last_date:)
113
- monthly_start_date = month.western_date.clone
114
- monthly_last_date = month.last_date.clone
115
-
116
- return false if monthly_start_date.invalid?
117
-
118
- return false if monthly_last_date.invalid?
119
-
120
- return false if under(monthly_start_date: monthly_start_date,
121
- start_date: start_date, last_date: last_date)
122
-
123
- return false if over(monthly_last_date: monthly_last_date,
124
- start_date: start_date, last_date: last_date)
125
-
126
- true
127
- end
128
- private_class_method :include?
129
-
130
- #
131
- # 範囲が月より前にあるか
132
- #
133
- # @param [Western::Calendar] monthly_start_date 月初日
134
- # @param [Western::Calendar] start_date 西暦開始日
135
- # @param [Western::Calendar] last_date 西暦終了日
136
- #
137
- # @return [True] 前にある
138
- # @return [False] 前にない
139
- #
140
- def self.under(monthly_start_date:, start_date:, last_date:)
141
- start_date < monthly_start_date && last_date < monthly_start_date
142
- end
143
- private_class_method :under
144
-
145
- #
146
- # 範囲が月より後にあるか
147
- #
148
- # @param [Western::Calendar] monthly_start_date 月末日
149
- # @param [Western::Calendar] start_date 西暦開始日
150
- # @param [Western::Calendar] last_date 西暦終了日
151
- #
152
- # @return [True] 後にある
153
- # @return [False] 後にない
154
- #
155
- def self.over(monthly_last_date:, start_date:, last_date:)
156
- start_date > monthly_last_date && last_date > monthly_last_date
157
- end
158
- private_class_method :over
159
- end
160
- end
161
- end
162
- end
@@ -1,87 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../base/year'
4
-
5
- require_relative '../../era/western/calendar'
6
- require_relative '../../output/response'
7
- require_relative '../../output/logger'
8
-
9
- # :nodoc:
10
- module Zakuro
11
- # :nodoc:
12
- module Calculation
13
- # :nodoc:
14
- module Specifier
15
- #
16
- # SingleDay 一日検索
17
- #
18
- module SingleDay
19
- # @return [Output::Logger] ロガー
20
- LOGGER = Output::Logger.new(location: 'specifier')
21
-
22
- #
23
- # 取得する
24
- #
25
- # @param [Array<Year>] yeas 範囲
26
- # @param [Western::Calendar] date 西暦日
27
- #
28
- # @return [Result::Data::SingleDay] 和暦日
29
- #
30
- def self.get(years: [], date: Western::Calendar.new)
31
- year, month = specify(years: years, date: date)
32
- first_date = month.western_date
33
-
34
- Output::Response::SingleDay.save_single_day(
35
- param: Output::Response::SingleDay::Param.new(
36
- year: year, month: month,
37
- date: date, days: date - first_date
38
- )
39
- )
40
- end
41
-
42
- #
43
- # 年を特定する
44
- #
45
- # @param [Array<Year>] years 範囲
46
- # @param [Western::Calendar] date 西暦日
47
- #
48
- # @return [Base::Year] 対象年
49
- # @return [Base::Month] 対象月
50
- #
51
- def self.specify(years:, date:)
52
- years.each do |year|
53
- month = specify_month(year: year, date: date)
54
- return year, month unless month.invalid?
55
- end
56
-
57
- raise ArgumentError, "invalid year range. date: #{date.format}"
58
- end
59
- private_class_method :specify
60
-
61
- # :reek:TooManyStatements { max_statements: 7 }
62
-
63
- #
64
- # 月を特定する
65
- #
66
- # @param [Base::Year] year 年
67
- # @param [Western::Calendar] date 西暦日
68
- #
69
- # @return [Base::Month] 対象月
70
- #
71
- def self.specify_month(year:, date:)
72
- months = year.months
73
-
74
- months.each do |month|
75
- western_date = month.western_date
76
- next if western_date.invalid?
77
-
78
- return month if month.include?(date: date)
79
- end
80
-
81
- Monthly::Month.new
82
- end
83
- private_class_method :specify_month
84
- end
85
- end
86
- end
87
- end
@@ -1,120 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../specifier/multiple_day'
4
-
5
- require_relative '../range/operated_range'
6
-
7
- require_relative '../range/full_range'
8
-
9
- require_relative './internal/operation'
10
-
11
- # :nodoc:
12
- module Zakuro
13
- # :nodoc:
14
- module Calculation
15
- # :nodoc:
16
- module Summary
17
- #
18
- # Range 期間
19
- #
20
- module Range
21
- #
22
- # 生成する
23
- #
24
- # @param [Context] context 暦コンテキスト
25
- # @param [Western::Calendar] start_date 西暦開始日
26
- # @param [Western::Calendar] last_date 西暦終了日
27
- #
28
- # @return [Result::Range] 期間検索結果(和暦日)
29
- #
30
- def self.get(context:, start_date: Western::Calendar.new, last_date: Western::Calendar.new)
31
- years = get_full_range_years(
32
- context: context, start_date: start_date, last_date: last_date
33
- )
34
- operated_years = get_operated_range_years(
35
- context: context, years: years, start_date: start_date, last_date: last_date
36
- )
37
-
38
- dates = Specifier::MultipleDay.get(
39
- years: years, start_date: start_date, last_date: last_date
40
- )
41
-
42
- operated_dates = Specifier::MultipleDay.get(
43
- years: operated_years, start_date: start_date, last_date: last_date
44
- )
45
-
46
- list = create_result_list(dates: dates, operated_dates: operated_dates)
47
-
48
- Result::Range.new(list: list)
49
- end
50
-
51
- #
52
- # 完全範囲を取得する
53
- #
54
- # @param [Context] context 暦コンテキスト
55
- # @param [Western::Calendar] start_date 西暦開始日
56
- # @param [Western::Calendar] last_date 西暦終了日
57
- #
58
- # @return [Array<Base::Year>] 完全範囲
59
- #
60
- def self.get_full_range_years(context:, start_date: Western::Calendar.new,
61
- last_date: Western::Calendar.new)
62
- full_range = Calculation::Range::FullRange.new(
63
- context: context, start_date: start_date, last_date: last_date
64
- )
65
- full_range.get
66
- end
67
- private_class_method :get_full_range_years
68
-
69
- #
70
- # 運用結果範囲を取得する
71
- #
72
- # @param [Context] context 暦コンテキスト
73
- # @param [Western::Calendar] start_date 西暦開始日
74
- # @param [Western::Calendar] last_date 西暦終了日
75
- # @param [Western::Calendar] date 西暦日
76
- #
77
- # @return [Array<Base::OperatedYear>] 運用結果範囲
78
- #
79
- def self.get_operated_range_years(context:, years:, start_date: Western::Calendar.new,
80
- last_date: Western::Calendar.new)
81
- operated_range = Calculation::Range::OperatedRange.new(
82
- context: context, start_date: start_date, last_date: last_date, years: years
83
- )
84
- operated_range.get
85
- end
86
- private_class_method :get_operated_range_years
87
-
88
- #
89
- # 結果リストを生成する
90
- #
91
- # @param [Array<Result::Data::SingleDay>] dates 検索結果(計算値)
92
- # @param [Array<Result::Data::SingleDay>] operated_dates 検索結果(運用値)
93
- #
94
- # @return [Array<Result::Single>] 結果リスト
95
- #
96
- def self.create_result_list(dates:, operated_dates:)
97
- result = []
98
-
99
- return result if dates.size != operated_dates.size
100
-
101
- (0..(dates.size - 1)).each do |index|
102
- data = operated_dates[index]
103
-
104
- date = dates[index]
105
- operation = Operation.create(calc_date: date)
106
-
107
- result.push(
108
- Result::Single.new(
109
- data: data,
110
- operation: operation
111
- )
112
- )
113
- end
114
-
115
- result
116
- end
117
- end
118
- end
119
- end
120
- end
@@ -1,110 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../specifier/single_day'
4
-
5
- require_relative '../range/operated_range'
6
-
7
- require_relative '../range/full_range'
8
-
9
- require_relative './internal/operation'
10
-
11
- # :nodoc:
12
- module Zakuro
13
- # :nodoc:
14
- module Calculation
15
- # :nodoc:
16
- module Summary
17
- #
18
- # Single 一日
19
- #
20
- module Single
21
- #
22
- # 生成する
23
- #
24
- # @param [Context] context 暦コンテキスト
25
- # @param [Western::Calendar] date 西暦日
26
- #
27
- # @return [Result::Single] 一日検索結果(和暦日)
28
- #
29
- def self.get(context:, date: Western::Calendar.new)
30
- years = get_full_range_years(context: context, date: date)
31
-
32
- data = get_data(context: context, years: years, date: date)
33
-
34
- operation = get_operation(years: years, date: date)
35
-
36
- Result::Single.new(
37
- data: data,
38
- operation: operation
39
- )
40
- end
41
-
42
- #
43
- # 完全範囲を取得する
44
- #
45
- # @param [Context] context 暦コンテキスト
46
- # @param [Western::Calendar] date 西暦日
47
- #
48
- # @return [Array<Base::Year>] 完全範囲
49
- #
50
- def self.get_full_range_years(context:, date: Western::Calendar.new)
51
- full_range = Calculation::Range::FullRange.new(context: context, start_date: date)
52
- full_range.get
53
- end
54
- private_class_method :get_full_range_years
55
-
56
- #
57
- # 運用結果範囲を取得する
58
- #
59
- # @param [Context] context 暦コンテキスト
60
- # @param [Array<Base::Year>] years 完全範囲
61
- # @param [Western::Calendar] date 西暦日
62
- #
63
- # @return [Array<Base::OperatedYear>] 運用結果範囲
64
- #
65
- def self.get_operated_range_years(context:, years:, date: Western::Calendar.new)
66
- operated_range = Calculation::Range::OperatedRange.new(
67
- context: context, start_date: date, years: years
68
- )
69
- operated_range.get
70
- end
71
- private_class_method :get_operated_range_years
72
-
73
- #
74
- # 1日を取得する
75
- #
76
- # @param [Context] context 暦コンテキスト
77
- # @param [Array<Base::Year>] years 完全範囲
78
- # @param [Western::Calendar] date 西暦日
79
- #
80
- # @return [Data::SingleDay] 1日
81
- #
82
- def self.get_data(context:, years:, date: Western::Calendar.new)
83
- operated_years = get_operated_range_years(context: context, years: years, date: date)
84
-
85
- Calculation::Specifier::SingleDay.get(
86
- years: operated_years, date: date
87
- )
88
- end
89
- private_class_method :get_data
90
-
91
- #
92
- # 完全範囲を取得する
93
- #
94
- # @param [Context] context 暦コンテキスト
95
- # @param [Western::Calendar] date 西暦日
96
- #
97
- # @return [Array<Base::Year>] 完全範囲
98
- #
99
- def self.get_operation(years:, date: Western::Calendar.new)
100
- calc_date = Calculation::Specifier::SingleDay.get(
101
- years: years, date: date
102
- )
103
-
104
- Operation.create(calc_date: calc_date)
105
- end
106
- private_class_method :get_operation
107
- end
108
- end
109
- end
110
- end
@@ -1,187 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative './core'
4
-
5
- # :nodoc:
6
- module Zakuro
7
- #
8
- # Result 演算結果
9
- #
10
- module Result
11
- #
12
- # データ部
13
- #
14
- module Data
15
- #
16
- # SingleDay 1日
17
- #
18
- class SingleDay < Core
19
- # @return [Year] 年
20
- attr_reader :year
21
- # @return [Month] 月
22
- attr_reader :month
23
- # @return [Day] 日
24
- attr_reader :day
25
-
26
- #
27
- # 初期化
28
- #
29
- # @param [Year] year 年
30
- # @param [Month] month 月
31
- # @param [Day] day 日
32
- #
33
- def initialize(year:, month:, day:)
34
- super
35
- @year = year
36
- @month = month
37
- @day = day
38
- end
39
- end
40
-
41
- #
42
- # Gengou 元号
43
- #
44
- class Gengou
45
- # @return [String] 元号名
46
- attr_reader :name
47
- # @return [Integer] 元号年
48
- attr_reader :number
49
-
50
- #
51
- # 初期化
52
- #
53
- # @param [String] name 元号名
54
- # @param [Integer] number 元号年
55
- #
56
- def initialize(name: '', number: -1)
57
- @name = name
58
- @number = number
59
- end
60
- end
61
-
62
- #
63
- # Year 年
64
- #
65
- class Year
66
- # @return [Gengou] 元号(1行目)
67
- attr_reader :first_gengou
68
- # @return [Gengou] 元号(2行目)
69
- attr_reader :second_gengou
70
- # @return [String] 十干十二支
71
- attr_reader :zodiac_name
72
- # @return [Integer] 日数
73
- attr_reader :total_days
74
-
75
- #
76
- # 初期化
77
- #
78
- # @param [Gengou] first_gengou 元号(1行目)
79
- # @param [Gengou] second_gengou 元号(2行目)
80
- # @param [String] zodiac_name 十干十二支
81
- # @param [Integer] total_days 日数
82
- #
83
- def initialize(first_gengou:, second_gengou:, zodiac_name:, total_days:)
84
- @first_gengou = first_gengou
85
- @second_gengou = second_gengou
86
- @zodiac_name = zodiac_name
87
- @total_days = total_days
88
- end
89
- end
90
-
91
- #
92
- # SolarTerm 二十四節気
93
- #
94
- class SolarTerm
95
- # @return [Integer] 連番
96
- attr_reader :index
97
- # @return [String] 大余小余
98
- attr_reader :remainder
99
-
100
- #
101
- # 初期化
102
- #
103
- # @param [Integer] index 連番
104
- # @param [String] remainder 大余小余
105
- #
106
- def initialize(index:, remainder:)
107
- @index = index
108
- @remainder = remainder
109
- end
110
- end
111
-
112
- # :reek:TooManyInstanceVariables { max_instance_variables: 6 }
113
-
114
- #
115
- # Month 月
116
- #
117
- class Month
118
- # @return [Integer] 月順(1-12)
119
- attr_reader :number
120
- # @return [True] 閏月
121
- # @return [False] 平月
122
- attr_reader :leaped
123
- # @return [String] 月の大小
124
- attr_reader :days_name
125
- # @return [Day] 月初日データ
126
- attr_reader :first_day
127
- # @return [SolarTerm] 二十四節気(節気)
128
- attr_reader :odd_solar_terms
129
- # @return [SolarTerm] 二十四節気(中気)
130
- attr_reader :even_solar_terms
131
-
132
- # rubocop:disable Metrics/ParameterLists
133
- # :reek:LongParameterList { max_params: 6 }
134
-
135
- #
136
- # 初期化
137
- #
138
- # @param [Integer] number 月順(1-12)
139
- # @param [True, False] leaped 閏月/平月
140
- # @param [String] days_name 月の大小
141
- # @param [Day] first_day 月初日データ
142
- # @param [SolarTerm] odd_solar_terms 二十四節気(節気)
143
- # @param [SolarTerm] even_solar_terms 二十四節気(中気)
144
- #
145
- def initialize(number:, leaped:, days_name:, first_day:,
146
- odd_solar_terms:, even_solar_terms:)
147
- @number = number
148
- @leaped = leaped
149
- @days_name = days_name
150
- @first_day = first_day
151
- @odd_solar_terms = odd_solar_terms
152
- @even_solar_terms = even_solar_terms
153
- end
154
- # rubocop:enable Metrics/ParameterLists
155
- end
156
-
157
- #
158
- # Day 日
159
- #
160
- class Day
161
- # @return [Integer] 月初日から数えた日(M月d日のdに相当)
162
- attr_reader :number
163
- # @return [String] 十干十二支
164
- attr_reader :zodiac_name
165
- # @return [String] 大余小余
166
- attr_reader :remainder
167
- # @return [String] 年月日
168
- attr_reader :western_date
169
-
170
- #
171
- # 初期化
172
- #
173
- # @param [Integer] number 月初日から数えた日(M月d日のdに相当)
174
- # @param [String] zodiac_name 十干十二支
175
- # @param [String] remainder 大余小余
176
- # @param [String] western_date 年月日
177
- #
178
- def initialize(number:, zodiac_name:, remainder:, western_date:)
179
- @number = number
180
- @zodiac_name = zodiac_name
181
- @remainder = remainder
182
- @western_date = western_date
183
- end
184
- end
185
- end
186
- end
187
- end