zakuro 0.7.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -10
- data/VERSION +1 -1
- data/doc/dropped_date.md +93 -0
- data/doc/error.md +45 -0
- data/lib/zakuro/calculation/base/day.rb +52 -0
- data/lib/zakuro/calculation/base/operated_year.rb +3 -3
- data/lib/zakuro/calculation/base/year.rb +4 -4
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +5 -3
- data/lib/zakuro/calculation/monthly/initialized_month.rb +1 -1
- data/lib/zakuro/calculation/monthly/month.rb +3 -3
- data/lib/zakuro/calculation/monthly/operated_month.rb +1 -1
- data/lib/zakuro/calculation/option/dropped_date/abstract_parameter.rb +44 -0
- data/lib/zakuro/calculation/option/dropped_date/location.rb +135 -0
- data/lib/zakuro/calculation/range/abstract_full_range.rb +10 -8
- data/lib/zakuro/calculation/range/abstract_operation_range.rb +2 -2
- data/lib/zakuro/calculation/range/dated_full_range.rb +1 -1
- data/lib/zakuro/calculation/range/dated_operation_range.rb +1 -1
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +2 -2
- data/lib/zakuro/calculation/range/named_full_range.rb +1 -1
- data/lib/zakuro/calculation/range/named_operation_range.rb +1 -1
- data/lib/zakuro/calculation/range/operated_solar_terms.rb +9 -9
- data/lib/zakuro/calculation/range/transfer/year_boundary.rb +6 -6
- data/lib/zakuro/calculation/stella/solar/abstract_location.rb +2 -0
- data/lib/zakuro/calculation/summary/internal/day.rb +40 -0
- data/lib/zakuro/calculation/summary/internal/month.rb +15 -7
- data/lib/zakuro/calculation/summary/internal/option.rb +85 -0
- data/lib/zakuro/calculation/summary/japan/range.rb +15 -9
- data/lib/zakuro/calculation/summary/japan/single.rb +6 -6
- data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +10 -5
- data/lib/zakuro/calculation/summary/western/range.rb +5 -5
- data/lib/zakuro/calculation/summary/western/single.rb +9 -9
- data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +15 -10
- data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +12 -7
- data/lib/zakuro/calculation/type/optional.rb +46 -0
- data/lib/zakuro/condition.rb +60 -20
- data/lib/zakuro/context/context.rb +44 -0
- data/lib/zakuro/context/option.rb +117 -0
- data/lib/zakuro/context/version_class_resolver.rb +110 -0
- data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +4 -0
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +2 -0
- data/lib/zakuro/era/japan/gengou/resource/type.rb +6 -0
- data/lib/zakuro/era/western/calendar.rb +4 -0
- data/lib/zakuro/exception/case/pattern.rb +39 -3
- data/lib/zakuro/exception/exception.rb +3 -3
- data/lib/zakuro/exception/zakuro_error.rb +19 -1
- data/lib/zakuro/gateway/range.rb +2 -2
- data/lib/zakuro/gateway/single.rb +1 -1
- data/lib/zakuro/merchant.rb +78 -8
- data/lib/zakuro/operation/month/parser.rb +2 -0
- data/lib/zakuro/output/response.rb +24 -57
- data/lib/zakuro/result/data/option/abstract_option.rb +37 -0
- data/lib/zakuro/result/data/option/dropped_date/calculation.rb +47 -0
- data/lib/zakuro/result/data/option/dropped_date/option.rb +47 -0
- data/lib/zakuro/result/data/option/dropped_date/solar_term.rb +48 -0
- data/lib/zakuro/result/data/single_day.rb +9 -1
- data/lib/zakuro/result/operation/{operation.rb → bundle.rb} +0 -0
- data/lib/zakuro/result/result.rb +1 -1
- data/lib/zakuro/tools/stringifier.rb +26 -3
- data/lib/zakuro/version/daien/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/daien/range/annual_range.rb +1 -1
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +2 -0
- data/lib/zakuro/version/daien/stella/lunar/value.rb +2 -0
- data/lib/zakuro/version/genka/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/genka/range/annual_range.rb +1 -1
- data/lib/zakuro/version/gihou/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/gihou/range/annual_range.rb +1 -1
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +2 -0
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +2 -0
- data/lib/zakuro/version/senmyou/const/remainder.rb +5 -0
- data/lib/zakuro/version/senmyou/cycle/remainder.rb +37 -2
- data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +33 -0
- data/lib/zakuro/version/senmyou/range/annual_range.rb +1 -1
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +2 -0
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +2 -0
- metadata +26 -9
- data/lib/zakuro/version/context.rb +0 -44
- data/lib/zakuro/version/version_class_resolver.rb +0 -74
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
require_relative '../core'
|
4
4
|
|
5
|
+
require_relative './option/abstract_option'
|
6
|
+
|
7
|
+
require_relative './option/dropped_date/option'
|
8
|
+
|
5
9
|
require_relative 'year'
|
6
10
|
|
7
11
|
require_relative 'month'
|
@@ -28,6 +32,8 @@ module Zakuro
|
|
28
32
|
attr_reader :month
|
29
33
|
# @return [Day] 日
|
30
34
|
attr_reader :day
|
35
|
+
# @return [Hash<String, Option::AbstractOption>] オプション
|
36
|
+
attr_reader :options
|
31
37
|
|
32
38
|
#
|
33
39
|
# 初期化
|
@@ -35,12 +41,14 @@ module Zakuro
|
|
35
41
|
# @param [Year] year 年
|
36
42
|
# @param [Month] month 月
|
37
43
|
# @param [Day] day 日
|
44
|
+
# @param [Hash<String, Option::AbstractOption>] options オプション
|
38
45
|
#
|
39
|
-
def initialize(year:, month:, day:)
|
46
|
+
def initialize(year:, month:, day:, options: {})
|
40
47
|
super
|
41
48
|
@year = year
|
42
49
|
@month = month
|
43
50
|
@day = day
|
51
|
+
@options = options
|
44
52
|
end
|
45
53
|
end
|
46
54
|
end
|
File without changes
|
data/lib/zakuro/result/result.rb
CHANGED
@@ -17,6 +17,7 @@ module Zakuro
|
|
17
17
|
#
|
18
18
|
# @param [Object] obj 対象インスタンス
|
19
19
|
# @param [String] class_prefix インスタンス内でハッシュ変換するクラスのプレフィックス
|
20
|
+
# @param [True, False] formatted 整形有無
|
20
21
|
#
|
21
22
|
# @return [Hash<String, Objcet>] ハッシュ
|
22
23
|
#
|
@@ -31,13 +32,12 @@ module Zakuro
|
|
31
32
|
hash
|
32
33
|
end
|
33
34
|
|
34
|
-
# :reek:TooManyStatements { max_statements: 7 }
|
35
|
-
|
36
35
|
#
|
37
36
|
# 対象インスタンスをハッシュ化する(再帰処理)
|
38
37
|
#
|
39
38
|
# @param [Object] obj 対象インスタンス
|
40
39
|
# @param [String] class_prefix インスタンス内でハッシュ変換するクラスのプレフィックス
|
40
|
+
# @param [True, False] formatted 整形有無
|
41
41
|
#
|
42
42
|
# @return [Hash<String, Objcet>] ハッシュ
|
43
43
|
#
|
@@ -52,6 +52,20 @@ module Zakuro
|
|
52
52
|
return to_h(obj: obj, class_prefix: class_prefix, formatted: formatted)
|
53
53
|
end
|
54
54
|
|
55
|
+
general_value_to_hash(obj: obj, class_prefix: class_prefix, formatted: formatted)
|
56
|
+
end
|
57
|
+
private_class_method :value_to_hash
|
58
|
+
|
59
|
+
#
|
60
|
+
# ライブラリを問わない標準的な値をハッシュ化する(再帰処理)
|
61
|
+
#
|
62
|
+
# @param [Object] obj 対象インスタンス
|
63
|
+
# @param [String] class_prefix インスタンス内でハッシュ変換するクラスのプレフィックス
|
64
|
+
# @param [True, False] formatted 整形有無
|
65
|
+
#
|
66
|
+
# @return [Objcet] ハッシュ変換可能な値
|
67
|
+
#
|
68
|
+
def self.general_value_to_hash(obj:, class_prefix:, formatted:)
|
55
69
|
# 配列は要素一つずつで再帰する
|
56
70
|
if obj.is_a?(Array)
|
57
71
|
arr = []
|
@@ -61,9 +75,18 @@ module Zakuro
|
|
61
75
|
return arr
|
62
76
|
end
|
63
77
|
|
78
|
+
# ハッシュはキーごとに再帰する
|
79
|
+
if obj.is_a?(Hash)
|
80
|
+
hash = {}
|
81
|
+
obj.each do |key, value|
|
82
|
+
hash[key] = to_h(obj: value, class_prefix: class_prefix, formatted: formatted)
|
83
|
+
end
|
84
|
+
return hash
|
85
|
+
end
|
86
|
+
|
64
87
|
obj
|
65
88
|
end
|
66
|
-
private_class_method :
|
89
|
+
private_class_method :general_value_to_hash
|
67
90
|
end
|
68
91
|
end
|
69
92
|
end
|
@@ -29,7 +29,7 @@ module Zakuro
|
|
29
29
|
# @param [Integer] total 繰り上げなしの小余
|
30
30
|
#
|
31
31
|
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
32
|
-
super(base_day: Const::Number::Cycle::DAY,
|
32
|
+
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
33
33
|
day: day, minute: minute, second: second, total: total)
|
34
34
|
end
|
35
35
|
|
@@ -63,7 +63,7 @@ module Zakuro
|
|
63
63
|
# @param [Integer] total 繰り上げなしの小余
|
64
64
|
#
|
65
65
|
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
66
|
-
super(base_day: Const::Number::Cycle::DAY,
|
66
|
+
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
67
67
|
day: day, minute: minute, second: second, total: total)
|
68
68
|
end
|
69
69
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../calculation/option/dropped_date/abstract_parameter'
|
4
|
+
|
5
|
+
require_relative '../../const/number'
|
6
|
+
require_relative '../../const/remainder'
|
7
|
+
require_relative '../../cycle/remainder'
|
8
|
+
|
9
|
+
# :nodoc:
|
10
|
+
module Zakuro
|
11
|
+
# :nodoc:
|
12
|
+
module Senmyou
|
13
|
+
# :nodoc:
|
14
|
+
module Daien
|
15
|
+
# :nodoc:
|
16
|
+
module DroppedDate
|
17
|
+
#
|
18
|
+
# Parameter 引数
|
19
|
+
#
|
20
|
+
class Parameter < Calculation::Option::DroppedDate::AbstractParameter
|
21
|
+
#
|
22
|
+
# 初期化
|
23
|
+
#
|
24
|
+
def initialize
|
25
|
+
super(valid: false)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -30,7 +30,7 @@ module Zakuro
|
|
30
30
|
# @param [Integer] total 繰り上げなしの小余
|
31
31
|
#
|
32
32
|
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
33
|
-
super(base_day: Const::Number::Cycle::DAY,
|
33
|
+
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
34
34
|
day: day, minute: minute, second: second, total: total)
|
35
35
|
end
|
36
36
|
|
@@ -67,7 +67,7 @@ module Zakuro
|
|
67
67
|
# @param [Integer] total 繰り上げなしの小余
|
68
68
|
#
|
69
69
|
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
70
|
-
super(base_day: Const::Number::Cycle::TERM_DAY,
|
70
|
+
super(base_day: Const::Number::Cycle::TERM_DAY, base_minute: MINUTE,
|
71
71
|
day: day, minute: minute, second: second, total: total)
|
72
72
|
end
|
73
73
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../calculation/option/dropped_date/abstract_parameter'
|
4
|
+
|
5
|
+
require_relative '../../const/number'
|
6
|
+
require_relative '../../const/remainder'
|
7
|
+
require_relative '../../cycle/remainder'
|
8
|
+
|
9
|
+
# :nodoc:
|
10
|
+
module Zakuro
|
11
|
+
# :nodoc:
|
12
|
+
module Genka
|
13
|
+
# :nodoc:
|
14
|
+
module Option
|
15
|
+
# :nodoc:
|
16
|
+
module DroppedDate
|
17
|
+
#
|
18
|
+
# Parameter 引数
|
19
|
+
#
|
20
|
+
class Parameter < Calculation::Option::DroppedDate::AbstractParameter
|
21
|
+
#
|
22
|
+
# 初期化
|
23
|
+
#
|
24
|
+
def initialize
|
25
|
+
super(valid: false)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -26,7 +26,7 @@ module Zakuro
|
|
26
26
|
# @param [Integer] total 繰り上げなしの小余
|
27
27
|
#
|
28
28
|
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
29
|
-
super(base_day: Const::Number::Cycle::DAY,
|
29
|
+
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
30
30
|
day: day, minute: minute, second: second, total: total)
|
31
31
|
end
|
32
32
|
|
@@ -60,7 +60,7 @@ module Zakuro
|
|
60
60
|
# @param [Integer] total 繰り上げなしの小余
|
61
61
|
#
|
62
62
|
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
63
|
-
super(base_day: Const::Number::Cycle::DAY,
|
63
|
+
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
64
64
|
day: day, minute: minute, second: second, total: total)
|
65
65
|
end
|
66
66
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../calculation/option/dropped_date/abstract_parameter'
|
4
|
+
|
5
|
+
require_relative '../../const/number'
|
6
|
+
require_relative '../../const/remainder'
|
7
|
+
require_relative '../../cycle/remainder'
|
8
|
+
|
9
|
+
# :nodoc:
|
10
|
+
module Zakuro
|
11
|
+
# :nodoc:
|
12
|
+
module Gihou
|
13
|
+
# :nodoc:
|
14
|
+
module Option
|
15
|
+
# :nodoc:
|
16
|
+
module DroppedDate
|
17
|
+
#
|
18
|
+
# Parameter 引数
|
19
|
+
#
|
20
|
+
class Parameter < Calculation::Option::DroppedDate::AbstractParameter
|
21
|
+
#
|
22
|
+
# 初期化
|
23
|
+
#
|
24
|
+
def initialize
|
25
|
+
super(valid: false)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -25,6 +25,11 @@ module Zakuro
|
|
25
25
|
#
|
26
26
|
# @return [Cycle::Remainder] 弦(1分=8秒)
|
27
27
|
QUARTER = Cycle::Remainder.new(day: 7, minute: 3214, second: 2)
|
28
|
+
|
29
|
+
# @return [Cycle::Remainder] 有没判定
|
30
|
+
# * 中盈(小余3671秒2)/ 2 = 小余1835秒5
|
31
|
+
# * 日(小余8400) - 小余1835秒5 = 小余6564秒3
|
32
|
+
DROPPED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 6564, second: 3)
|
28
33
|
end
|
29
34
|
|
30
35
|
#
|
@@ -26,7 +26,7 @@ module Zakuro
|
|
26
26
|
# @param [Integer] total 繰り上げなしの小余
|
27
27
|
#
|
28
28
|
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
29
|
-
super(base_day: Const::Number::Cycle::DAY,
|
29
|
+
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
30
30
|
day: day, minute: minute, second: second, total: total)
|
31
31
|
end
|
32
32
|
|
@@ -60,7 +60,42 @@ module Zakuro
|
|
60
60
|
# @param [Integer] total 繰り上げなしの小余
|
61
61
|
#
|
62
62
|
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
63
|
-
super(base_day: Const::Number::Cycle::DAY,
|
63
|
+
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
64
|
+
day: day, minute: minute, second: second, total: total)
|
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
|
79
|
+
end
|
80
|
+
|
81
|
+
#
|
82
|
+
# DroppedRemainder 没日の計算向け時刻情報(没余)
|
83
|
+
#
|
84
|
+
class DroppedRemainder < Calculation::Cycle::AbstractRemainder
|
85
|
+
# @return [Integer] 分(1分=8秒)
|
86
|
+
MINUTE = 8
|
87
|
+
|
88
|
+
#
|
89
|
+
# 初期化
|
90
|
+
#
|
91
|
+
# @param [Integer] day 大余("日"に相当)
|
92
|
+
# @param [Integer] minute 小余("分"に相当)
|
93
|
+
# @param [Integer] second 秒
|
94
|
+
# @param [Integer] total 繰り上げなしの小余
|
95
|
+
#
|
96
|
+
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
97
|
+
# 小余 = 通余
|
98
|
+
super(base_day: Const::Number::Derivation::REMAINDER_ALL_YEAR, base_minute: MINUTE,
|
64
99
|
day: day, minute: minute, second: second, total: total)
|
65
100
|
end
|
66
101
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../calculation/option/dropped_date/abstract_parameter'
|
4
|
+
|
5
|
+
require_relative '../../const/number'
|
6
|
+
require_relative '../../const/remainder'
|
7
|
+
require_relative '../../cycle/remainder'
|
8
|
+
|
9
|
+
# :nodoc:
|
10
|
+
module Zakuro
|
11
|
+
# :nodoc:
|
12
|
+
module Senmyou
|
13
|
+
# :nodoc:
|
14
|
+
module Option
|
15
|
+
# :nodoc:
|
16
|
+
module DroppedDate
|
17
|
+
#
|
18
|
+
# Parameter 引数
|
19
|
+
#
|
20
|
+
class Parameter < Calculation::Option::DroppedDate::AbstractParameter
|
21
|
+
#
|
22
|
+
# 初期化
|
23
|
+
#
|
24
|
+
def initialize
|
25
|
+
super(valid: true, year: Const::Number::Cycle::YEAR,
|
26
|
+
limit: Const::Remainder::Solar::DROPPED_DATE_LIMIT,
|
27
|
+
remainder_class: Cycle::DroppedRemainder)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
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.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pldb
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: mainly lunar solar calendar
|
14
14
|
email:
|
@@ -29,6 +29,8 @@ files:
|
|
29
29
|
- VERSION
|
30
30
|
- bin/console
|
31
31
|
- bin/setup
|
32
|
+
- doc/dropped_date.md
|
33
|
+
- doc/error.md
|
32
34
|
- doc/gengou.md
|
33
35
|
- doc/operation.md
|
34
36
|
- doc/operation/csv/month.csv
|
@@ -41,6 +43,7 @@ files:
|
|
41
43
|
- images/各月の求め方.png
|
42
44
|
- images/太陽と月.png
|
43
45
|
- lib/zakuro.rb
|
46
|
+
- lib/zakuro/calculation/base/day.rb
|
44
47
|
- lib/zakuro/calculation/base/gengou.rb
|
45
48
|
- lib/zakuro/calculation/base/linear_gengou.rb
|
46
49
|
- lib/zakuro/calculation/base/operated_year.rb
|
@@ -71,6 +74,8 @@ files:
|
|
71
74
|
- lib/zakuro/calculation/monthly/month.rb
|
72
75
|
- lib/zakuro/calculation/monthly/month_label.rb
|
73
76
|
- lib/zakuro/calculation/monthly/operated_month.rb
|
77
|
+
- lib/zakuro/calculation/option/dropped_date/abstract_parameter.rb
|
78
|
+
- lib/zakuro/calculation/option/dropped_date/location.rb
|
74
79
|
- lib/zakuro/calculation/range/abstract_full_range.rb
|
75
80
|
- lib/zakuro/calculation/range/abstract_operation_range.rb
|
76
81
|
- lib/zakuro/calculation/range/dated_full_range.rb
|
@@ -86,8 +91,10 @@ files:
|
|
86
91
|
- lib/zakuro/calculation/stella/solar/abstract_average.rb
|
87
92
|
- lib/zakuro/calculation/stella/solar/abstract_location.rb
|
88
93
|
- lib/zakuro/calculation/stella/solar/choukei_value.rb
|
94
|
+
- lib/zakuro/calculation/summary/internal/day.rb
|
89
95
|
- lib/zakuro/calculation/summary/internal/month.rb
|
90
96
|
- lib/zakuro/calculation/summary/internal/operation.rb
|
97
|
+
- lib/zakuro/calculation/summary/internal/option.rb
|
91
98
|
- lib/zakuro/calculation/summary/japan/range.rb
|
92
99
|
- lib/zakuro/calculation/summary/japan/single.rb
|
93
100
|
- lib/zakuro/calculation/summary/japan/specifier/single_day.rb
|
@@ -96,7 +103,11 @@ files:
|
|
96
103
|
- lib/zakuro/calculation/summary/western/specifier/multiple_day.rb
|
97
104
|
- lib/zakuro/calculation/summary/western/specifier/single_day.rb
|
98
105
|
- lib/zakuro/calculation/type/old_float.rb
|
106
|
+
- lib/zakuro/calculation/type/optional.rb
|
99
107
|
- lib/zakuro/condition.rb
|
108
|
+
- lib/zakuro/context/context.rb
|
109
|
+
- lib/zakuro/context/option.rb
|
110
|
+
- lib/zakuro/context/version_class_resolver.rb
|
100
111
|
- lib/zakuro/era/japan/calendar.rb
|
101
112
|
- lib/zakuro/era/japan/gengou.rb
|
102
113
|
- lib/zakuro/era/japan/gengou/alignment.rb
|
@@ -136,24 +147,28 @@ files:
|
|
136
147
|
- lib/zakuro/result/data/day.rb
|
137
148
|
- lib/zakuro/result/data/gengou.rb
|
138
149
|
- lib/zakuro/result/data/month.rb
|
150
|
+
- lib/zakuro/result/data/option/abstract_option.rb
|
151
|
+
- lib/zakuro/result/data/option/dropped_date/calculation.rb
|
152
|
+
- lib/zakuro/result/data/option/dropped_date/option.rb
|
153
|
+
- lib/zakuro/result/data/option/dropped_date/solar_term.rb
|
139
154
|
- lib/zakuro/result/data/single_day.rb
|
140
155
|
- lib/zakuro/result/data/solar_term.rb
|
141
156
|
- lib/zakuro/result/data/year.rb
|
157
|
+
- lib/zakuro/result/operation/bundle.rb
|
142
158
|
- lib/zakuro/result/operation/month/annotation.rb
|
143
159
|
- lib/zakuro/result/operation/month/bundle.rb
|
144
160
|
- lib/zakuro/result/operation/month/history.rb
|
145
|
-
- lib/zakuro/result/operation/operation.rb
|
146
161
|
- lib/zakuro/result/result.rb
|
147
162
|
- lib/zakuro/tools/stringifier.rb
|
148
163
|
- lib/zakuro/tools/typeconv.rb
|
149
164
|
- lib/zakuro/tools/typeof.rb
|
150
|
-
- lib/zakuro/version/context.rb
|
151
165
|
- lib/zakuro/version/daien/const/number.rb
|
152
166
|
- lib/zakuro/version/daien/const/remainder.rb
|
153
167
|
- lib/zakuro/version/daien/cycle/remainder.rb
|
154
168
|
- lib/zakuro/version/daien/cycle/solar_term.rb
|
155
169
|
- lib/zakuro/version/daien/daien.rb
|
156
170
|
- lib/zakuro/version/daien/monthly/lunar_phase.rb
|
171
|
+
- lib/zakuro/version/daien/option/dropped_date/parameter.rb
|
157
172
|
- lib/zakuro/version/daien/range/annual_range.rb
|
158
173
|
- lib/zakuro/version/daien/stella/lunar/adjustment.rb
|
159
174
|
- lib/zakuro/version/daien/stella/lunar/localization.rb
|
@@ -173,6 +188,7 @@ files:
|
|
173
188
|
- lib/zakuro/version/genka/cycle/solar_term.rb
|
174
189
|
- lib/zakuro/version/genka/genka.rb
|
175
190
|
- lib/zakuro/version/genka/monthly/lunar_phase.rb
|
191
|
+
- lib/zakuro/version/genka/option/dropped_date/parameter.rb
|
176
192
|
- lib/zakuro/version/genka/range/annual_range.rb
|
177
193
|
- lib/zakuro/version/genka/stella/origin/first_term.rb
|
178
194
|
- lib/zakuro/version/genka/stella/origin/january.rb
|
@@ -183,6 +199,7 @@ files:
|
|
183
199
|
- lib/zakuro/version/gihou/cycle/solar_term.rb
|
184
200
|
- lib/zakuro/version/gihou/gihou.rb
|
185
201
|
- lib/zakuro/version/gihou/monthly/lunar_phase.rb
|
202
|
+
- lib/zakuro/version/gihou/option/dropped_date/parameter.rb
|
186
203
|
- lib/zakuro/version/gihou/range/annual_range.rb
|
187
204
|
- lib/zakuro/version/gihou/stella/lunar/adjustment.rb
|
188
205
|
- lib/zakuro/version/gihou/stella/lunar/localization.rb
|
@@ -206,6 +223,7 @@ files:
|
|
206
223
|
- lib/zakuro/version/senmyou/cycle/remainder.rb
|
207
224
|
- lib/zakuro/version/senmyou/cycle/solar_term.rb
|
208
225
|
- lib/zakuro/version/senmyou/monthly/lunar_phase.rb
|
226
|
+
- lib/zakuro/version/senmyou/option/dropped_date/parameter.rb
|
209
227
|
- lib/zakuro/version/senmyou/range/annual_range.rb
|
210
228
|
- lib/zakuro/version/senmyou/senmyou.rb
|
211
229
|
- lib/zakuro/version/senmyou/stella/lunar/adjustment.rb
|
@@ -221,7 +239,6 @@ files:
|
|
221
239
|
- lib/zakuro/version/senmyou/stella/solar/location.rb
|
222
240
|
- lib/zakuro/version/senmyou/stella/solar/value.rb
|
223
241
|
- lib/zakuro/version/tenpou/tenpou.rb
|
224
|
-
- lib/zakuro/version/version_class_resolver.rb
|
225
242
|
- zakuro.gemspec
|
226
243
|
homepage: https://github.com/pldb/zakuro
|
227
244
|
licenses:
|
@@ -231,7 +248,7 @@ metadata:
|
|
231
248
|
homepage_uri: https://github.com/pldb/zakuro
|
232
249
|
source_code_uri: https://github.com/pldb/zakuro
|
233
250
|
changelog_uri: https://github.com/pldb/zakuro
|
234
|
-
post_install_message:
|
251
|
+
post_install_message:
|
235
252
|
rdoc_options: []
|
236
253
|
require_paths:
|
237
254
|
- lib
|
@@ -246,8 +263,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
263
|
- !ruby/object:Gem::Version
|
247
264
|
version: '0'
|
248
265
|
requirements: []
|
249
|
-
rubygems_version: 3.1.
|
250
|
-
signing_key:
|
266
|
+
rubygems_version: 3.1.4
|
267
|
+
signing_key:
|
251
268
|
specification_version: 4
|
252
269
|
summary: japanese calendar library.
|
253
270
|
test_files: []
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative './version_class_resolver'
|
4
|
-
|
5
|
-
# :nodoc:
|
6
|
-
module Zakuro
|
7
|
-
#
|
8
|
-
# Context 暦コンテキスト
|
9
|
-
#
|
10
|
-
class Context
|
11
|
-
# @return [String] 暦名
|
12
|
-
attr_reader :version_name
|
13
|
-
# @return [VersionClassResolver] 暦リゾルバー
|
14
|
-
attr_reader :resolver
|
15
|
-
|
16
|
-
# @return [Array<String>] 暦名
|
17
|
-
VERSION_NAMES = %w[Genka Gihou Daien Senmyou Joukyou Kansei Tenpou Gregorio].freeze
|
18
|
-
|
19
|
-
#
|
20
|
-
# 初期化
|
21
|
-
#
|
22
|
-
# @param [String] version_name 暦名
|
23
|
-
#
|
24
|
-
def initialize(version_name: '')
|
25
|
-
@version_name = version_name
|
26
|
-
|
27
|
-
if !invalid? && !VERSION_NAMES.include?(version_name)
|
28
|
-
raise ArgumentError.new, 'invalid version'
|
29
|
-
end
|
30
|
-
|
31
|
-
@resolver = VersionClassResolver.new(version_name: version_name)
|
32
|
-
end
|
33
|
-
|
34
|
-
#
|
35
|
-
# 不正か
|
36
|
-
#
|
37
|
-
# @return [True] 不正
|
38
|
-
# @return [False] 不正なし
|
39
|
-
#
|
40
|
-
def invalid?
|
41
|
-
@version_name.empty?
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|