decentworks-date-support 0.1.0 → 0.2.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 +4 -4
- data/CHANGELOG.md +89 -3
- data/LICENSE +1 -1
- data/README.md +268 -24
- data/lib/decentworks/date_support/configuration.rb +73 -0
- data/lib/decentworks/date_support/date.rb +9 -0
- data/lib/decentworks/date_support/date_extension.rb +761 -0
- data/lib/decentworks/date_support/date_time.rb +9 -0
- data/lib/decentworks/date_support/time.rb +7 -0
- data/lib/decentworks/date_support/time_extension.rb +742 -0
- data/lib/decentworks/date_support/time_with_zone.rb +12 -0
- data/lib/decentworks/date_support/version.rb +7 -0
- data/lib/decentworks/date_support.rb +8 -321
- data/lib/decentworks-date-support.rb +3 -0
- data/lib/generators/decentworks/date_support/install/install_generator.rb +26 -0
- data/lib/generators/decentworks/date_support/install/templates/decentworks_date_support.rb.tt +50 -0
- data/sig/decentworks/date_support/configuration.rbs +25 -0
- data/sig/decentworks/date_support/date.rbs +4 -0
- data/sig/decentworks/date_support/date_extension.rbs +244 -0
- data/sig/decentworks/date_support/date_time.rbs +4 -0
- data/sig/decentworks/date_support/time.rbs +4 -0
- data/sig/decentworks/date_support/time_extension.rbs +248 -0
- data/sig/decentworks/date_support/time_with_zone.rbs +21 -0
- data/sig/decentworks/date_support/version.rbs +5 -0
- metadata +27 -143
- data/.gem_rbs_collection/actionpack/7.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/actionpack/7.2/actioncontroller-7.2.rbs +0 -14
- data/.gem_rbs_collection/actionpack/7.2/actioncontroller.rbs +0 -290
- data/.gem_rbs_collection/actionpack/7.2/actiondispatch.rbs +0 -349
- data/.gem_rbs_collection/actionpack/7.2/actionpack-generated.rbs +0 -11497
- data/.gem_rbs_collection/actionpack/7.2/patch.rbs +0 -77
- data/.gem_rbs_collection/actionview/6.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/actionview/6.0/actionview-generated.rbs +0 -8976
- data/.gem_rbs_collection/actionview/6.0/actionview.rbs +0 -1940
- data/.gem_rbs_collection/actionview/6.0/patch.rbs +0 -57
- data/.gem_rbs_collection/activesupport/7.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/activesupport/7.0/activesupport-7.0.rbs +0 -381
- data/.gem_rbs_collection/activesupport/7.0/activesupport-generated.rbs +0 -11633
- data/.gem_rbs_collection/activesupport/7.0/activesupport.rbs +0 -724
- data/.gem_rbs_collection/activesupport/7.0/manifest.yaml +0 -15
- data/.gem_rbs_collection/activesupport/7.0/patch.rbs +0 -55
- data/.gem_rbs_collection/ast/2.4/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/ast/2.4/ast.rbs +0 -73
- data/.gem_rbs_collection/cgi/0.5/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/cgi/0.5/core.rbs +0 -925
- data/.gem_rbs_collection/cgi/0.5/manifest.yaml +0 -3
- data/.gem_rbs_collection/concurrent-ruby/1.1/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/concurrent-ruby/1.1/array.rbs +0 -4
- data/.gem_rbs_collection/concurrent-ruby/1.1/atomic_reference.rbs +0 -16
- data/.gem_rbs_collection/concurrent-ruby/1.1/executor.rbs +0 -96
- data/.gem_rbs_collection/concurrent-ruby/1.1/hash.rbs +0 -4
- data/.gem_rbs_collection/concurrent-ruby/1.1/map.rbs +0 -68
- data/.gem_rbs_collection/concurrent-ruby/1.1/promises.rbs +0 -249
- data/.gem_rbs_collection/concurrent-ruby/1.1/set.rbs +0 -4
- data/.gem_rbs_collection/concurrent-ruby/1.1/timer_task.rbs +0 -47
- data/.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs +0 -5
- data/.gem_rbs_collection/connection_pool/2.4/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/connection_pool/2.4/connection_pool.rbs +0 -34
- data/.gem_rbs_collection/connection_pool/2.4/manifest.yaml +0 -2
- data/.gem_rbs_collection/diff-lcs/1.5/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/diff-lcs/1.5/diff-lcs.rbs +0 -11
- data/.gem_rbs_collection/faker/3.4.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/faker/3.4.2/faker-2.23.rbs +0 -90
- data/.gem_rbs_collection/faker/3.4.2/faker.rbs +0 -18
- data/.gem_rbs_collection/i18n/1.10/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/i18n/1.10/backend.rbs +0 -274
- data/.gem_rbs_collection/i18n/1.10/i18n.rbs +0 -116
- data/.gem_rbs_collection/lint_roller/1.1/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/lint_roller/1.1/lint_roller.rbs +0 -48
- data/.gem_rbs_collection/minitest/5.25/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/minitest/5.25/minitest/abstract_reporter.rbs +0 -52
- data/.gem_rbs_collection/minitest/5.25/minitest/assertion.rbs +0 -17
- data/.gem_rbs_collection/minitest/5.25/minitest/assertions.rbs +0 -590
- data/.gem_rbs_collection/minitest/5.25/minitest/backtrace_filter.rbs +0 -23
- data/.gem_rbs_collection/minitest/5.25/minitest/bench_spec.rbs +0 -102
- data/.gem_rbs_collection/minitest/5.25/minitest/benchmark.rbs +0 -259
- data/.gem_rbs_collection/minitest/5.25/minitest/composite_reporter.rbs +0 -25
- data/.gem_rbs_collection/minitest/5.25/minitest/compress.rbs +0 -13
- data/.gem_rbs_collection/minitest/5.25/minitest/error_on_warning.rbs +0 -3
- data/.gem_rbs_collection/minitest/5.25/minitest/expectation.rbs +0 -2
- data/.gem_rbs_collection/minitest/5.25/minitest/expectations.rbs +0 -21
- data/.gem_rbs_collection/minitest/5.25/minitest/guard.rbs +0 -64
- data/.gem_rbs_collection/minitest/5.25/minitest/mock.rbs +0 -64
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/executor.rbs +0 -46
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/test/class_methods.rbs +0 -5
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/test.rbs +0 -3
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel.rbs +0 -2
- data/.gem_rbs_collection/minitest/5.25/minitest/pride_io.rbs +0 -62
- data/.gem_rbs_collection/minitest/5.25/minitest/pride_lol.rbs +0 -19
- data/.gem_rbs_collection/minitest/5.25/minitest/progress_reporter.rbs +0 -11
- data/.gem_rbs_collection/minitest/5.25/minitest/reportable.rbs +0 -53
- data/.gem_rbs_collection/minitest/5.25/minitest/reporter.rbs +0 -5
- data/.gem_rbs_collection/minitest/5.25/minitest/result.rbs +0 -28
- data/.gem_rbs_collection/minitest/5.25/minitest/runnable.rbs +0 -163
- data/.gem_rbs_collection/minitest/5.25/minitest/skip.rbs +0 -6
- data/.gem_rbs_collection/minitest/5.25/minitest/spec/dsl/instance_methods.rbs +0 -48
- data/.gem_rbs_collection/minitest/5.25/minitest/spec/dsl.rbs +0 -129
- data/.gem_rbs_collection/minitest/5.25/minitest/spec.rbs +0 -11
- data/.gem_rbs_collection/minitest/5.25/minitest/statistics_reporter.rbs +0 -81
- data/.gem_rbs_collection/minitest/5.25/minitest/summary_reporter.rbs +0 -18
- data/.gem_rbs_collection/minitest/5.25/minitest/test/lifecycle_hooks.rbs +0 -92
- data/.gem_rbs_collection/minitest/5.25/minitest/test.rbs +0 -69
- data/.gem_rbs_collection/minitest/5.25/minitest/unexpected_error.rbs +0 -12
- data/.gem_rbs_collection/minitest/5.25/minitest/unexpected_warning.rbs +0 -6
- data/.gem_rbs_collection/minitest/5.25/minitest/unit/test_case.rbs +0 -3
- data/.gem_rbs_collection/minitest/5.25/minitest/unit.rbs +0 -4
- data/.gem_rbs_collection/minitest/5.25/minitest.rbs +0 -115
- data/.gem_rbs_collection/nokogiri/1.11/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/nokogiri/1.11/nokogiri.rbs +0 -2332
- data/.gem_rbs_collection/nokogiri/1.11/patch.rbs +0 -4
- data/.gem_rbs_collection/parallel/1.20/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/parallel/1.20/parallel.rbs +0 -86
- data/.gem_rbs_collection/parser/3.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/parser/3.2/manifest.yaml +0 -7
- data/.gem_rbs_collection/parser/3.2/parser.rbs +0 -194
- data/.gem_rbs_collection/parser/3.2/polyfill.rbs +0 -4
- data/.gem_rbs_collection/rack/2.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rack/2.2/manifest.yaml +0 -3
- data/.gem_rbs_collection/rack/2.2/rack.rbs +0 -1480
- data/.gem_rbs_collection/rails-dom-testing/2.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rails-dom-testing/2.0/rails-dom-testing.rbs +0 -51
- data/.gem_rbs_collection/rails-html-sanitizer/1.6/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rails-html-sanitizer/1.6/rails-html-sanitizer.rbs +0 -53
- data/.gem_rbs_collection/railties/6.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/railties/6.0/manifest.yaml +0 -2
- data/.gem_rbs_collection/railties/6.0/patch.rbs +0 -17
- data/.gem_rbs_collection/railties/6.0/railties-generated.rbs +0 -4822
- data/.gem_rbs_collection/railties/6.0/railties.rbs +0 -44
- data/.gem_rbs_collection/rainbow/3.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rainbow/3.0/global.rbs +0 -7
- data/.gem_rbs_collection/rainbow/3.0/presenter.rbs +0 -209
- data/.gem_rbs_collection/rainbow/3.0/rainbow.rbs +0 -5
- data/.gem_rbs_collection/rake/13.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rake/13.0/manifest.yaml +0 -2
- data/.gem_rbs_collection/rake/13.0/rake.rbs +0 -39
- data/.gem_rbs_collection/regexp_parser/2.8/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/regexp_parser/2.8/regexp_parser.rbs +0 -17
- data/.gem_rbs_collection/rubocop/1.57/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rubocop/1.57/rubocop.rbs +0 -208
- data/.gem_rbs_collection/rubocop-ast/1.46/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rubocop-ast/1.46/rubocop-ast.rbs +0 -903
- data/.gem_rbs_collection/thor/1.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/thor/1.2/thor.rbs +0 -62
- data/.gem_rbs_collection/tzinfo/2.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/tzinfo/2.0/manifest.yaml +0 -7
- data/.gem_rbs_collection/tzinfo/2.0/tzinfo.rbs +0 -600
- data/.rspec +0 -3
- data/.rubocop.yml +0 -8
- data/.ruby-version +0 -1
- data/CODE_OF_CONDUCT.md +0 -132
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -12
- data/Steepfile +0 -43
- data/lib/decentworks/active_support/time_with_zone_support.rb +0 -327
- data/lib/decentworks/date/support/version.rb +0 -9
- data/lib/decentworks_date_support.rb +0 -4
- data/rbs_collection.lock.yaml +0 -288
- data/rbs_collection.yaml +0 -41
- data/sig/decentworks/active_support/time_with_zone_support.rbs +0 -109
- data/sig/decentworks/date/support.rbs +0 -8
- data/sig/decentworks/date_support.rbs +0 -107
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
module Decentworks
|
|
2
|
+
module DateSupport
|
|
3
|
+
# ::Date が備えているActiveSupport(DateAndTime::Calculations)由来のメソッドと、
|
|
4
|
+
# モジュール内部でレシーバとして使うメソッド。
|
|
5
|
+
#
|
|
6
|
+
# DateExtension のself型として指定することで、モジュール内部での
|
|
7
|
+
# レシーバ省略呼び出しを型検査できるようにする。
|
|
8
|
+
#
|
|
9
|
+
# self型に ::Date を直接指定すると、::Date が DateExtension をincludeしているため
|
|
10
|
+
# RBS::RecursiveAncestor(循環)になる。そのためinterfaceを経由する。
|
|
11
|
+
interface _DateCalculations
|
|
12
|
+
def ==: (untyped other) -> bool
|
|
13
|
+
def month: () -> ::Integer
|
|
14
|
+
def beginning_of_week: (?untyped start_day) -> ::Date
|
|
15
|
+
def beginning_of_month: () -> ::Date
|
|
16
|
+
def end_of_month: () -> ::Date
|
|
17
|
+
def months_ago: (untyped months) -> ::Date
|
|
18
|
+
def months_since: (untyped months) -> ::Date
|
|
19
|
+
def change: (untyped options) -> ::Date
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# ::Date の日付拡張
|
|
23
|
+
#
|
|
24
|
+
# 各メソッドは ::Date を返す。
|
|
25
|
+
module DateExtension : _DateCalculations
|
|
26
|
+
module ClassMethods
|
|
27
|
+
def whole_months_elapsed: (from: ::Date, to: ::Date) -> ::Integer
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def expiration_date: (from: ::Date, months: ::Integer) -> ::Date
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.included: (untyped base) -> untyped
|
|
35
|
+
|
|
36
|
+
def beginning_of_this_week: -> ::Date
|
|
37
|
+
def end_of_this_week: -> ::Date
|
|
38
|
+
def all_this_week: -> ::Range[::Date]
|
|
39
|
+
|
|
40
|
+
def beginning_of_this_month: -> ::Date
|
|
41
|
+
def end_of_this_month: -> ::Date
|
|
42
|
+
def all_this_month: -> ::Range[::Date]
|
|
43
|
+
|
|
44
|
+
def two_months_ago: -> ::Date
|
|
45
|
+
def three_months_ago: -> ::Date
|
|
46
|
+
def four_months_ago: -> ::Date
|
|
47
|
+
def five_months_ago: -> ::Date
|
|
48
|
+
def six_months_ago: -> ::Date
|
|
49
|
+
def half_year_ago: -> ::Date
|
|
50
|
+
def seven_months_ago: -> ::Date
|
|
51
|
+
def eight_months_ago: -> ::Date
|
|
52
|
+
def nine_months_ago: -> ::Date
|
|
53
|
+
def ten_months_ago: -> ::Date
|
|
54
|
+
def eleven_months_ago: -> ::Date
|
|
55
|
+
|
|
56
|
+
def two_months_since: -> ::Date
|
|
57
|
+
def three_months_since: -> ::Date
|
|
58
|
+
def four_months_since: -> ::Date
|
|
59
|
+
def five_months_since: -> ::Date
|
|
60
|
+
def six_months_since: -> ::Date
|
|
61
|
+
def half_year_since: -> ::Date
|
|
62
|
+
def seven_months_since: -> ::Date
|
|
63
|
+
def eight_months_since: -> ::Date
|
|
64
|
+
def nine_months_since: -> ::Date
|
|
65
|
+
def ten_months_since: -> ::Date
|
|
66
|
+
def eleven_months_since: -> ::Date
|
|
67
|
+
|
|
68
|
+
def beginning_of_january: -> ::Date
|
|
69
|
+
def end_of_january: -> ::Date
|
|
70
|
+
def all_january: -> ::Range[::Date]
|
|
71
|
+
def beginning_of_january?: -> bool
|
|
72
|
+
def end_of_january?: -> bool
|
|
73
|
+
def in_january?: -> bool
|
|
74
|
+
|
|
75
|
+
def beginning_of_february: -> ::Date
|
|
76
|
+
def end_of_february: -> ::Date
|
|
77
|
+
def all_february: -> ::Range[::Date]
|
|
78
|
+
def beginning_of_february?: -> bool
|
|
79
|
+
def end_of_february?: -> bool
|
|
80
|
+
def in_february?: -> bool
|
|
81
|
+
|
|
82
|
+
def beginning_of_march: -> ::Date
|
|
83
|
+
def end_of_march: -> ::Date
|
|
84
|
+
def all_march: -> ::Range[::Date]
|
|
85
|
+
def beginning_of_march?: -> bool
|
|
86
|
+
def end_of_march?: -> bool
|
|
87
|
+
def in_march?: -> bool
|
|
88
|
+
|
|
89
|
+
def beginning_of_april: -> ::Date
|
|
90
|
+
def end_of_april: -> ::Date
|
|
91
|
+
def all_april: -> ::Range[::Date]
|
|
92
|
+
def beginning_of_april?: -> bool
|
|
93
|
+
def end_of_april?: -> bool
|
|
94
|
+
def in_april?: -> bool
|
|
95
|
+
|
|
96
|
+
def beginning_of_may: -> ::Date
|
|
97
|
+
def end_of_may: -> ::Date
|
|
98
|
+
def all_may: -> ::Range[::Date]
|
|
99
|
+
def beginning_of_may?: -> bool
|
|
100
|
+
def end_of_may?: -> bool
|
|
101
|
+
def in_may?: -> bool
|
|
102
|
+
|
|
103
|
+
def beginning_of_june: -> ::Date
|
|
104
|
+
def end_of_june: -> ::Date
|
|
105
|
+
def all_june: -> ::Range[::Date]
|
|
106
|
+
def beginning_of_june?: -> bool
|
|
107
|
+
def end_of_june?: -> bool
|
|
108
|
+
def in_june?: -> bool
|
|
109
|
+
|
|
110
|
+
def beginning_of_july: -> ::Date
|
|
111
|
+
def end_of_july: -> ::Date
|
|
112
|
+
def all_july: -> ::Range[::Date]
|
|
113
|
+
def beginning_of_july?: -> bool
|
|
114
|
+
def end_of_july?: -> bool
|
|
115
|
+
def in_july?: -> bool
|
|
116
|
+
|
|
117
|
+
def beginning_of_august: -> ::Date
|
|
118
|
+
def end_of_august: -> ::Date
|
|
119
|
+
def all_august: -> ::Range[::Date]
|
|
120
|
+
def beginning_of_august?: -> bool
|
|
121
|
+
def end_of_august?: -> bool
|
|
122
|
+
def in_august?: -> bool
|
|
123
|
+
|
|
124
|
+
def beginning_of_september: -> ::Date
|
|
125
|
+
def end_of_september: -> ::Date
|
|
126
|
+
def all_september: -> ::Range[::Date]
|
|
127
|
+
def beginning_of_september?: -> bool
|
|
128
|
+
def end_of_september?: -> bool
|
|
129
|
+
def in_september?: -> bool
|
|
130
|
+
|
|
131
|
+
def beginning_of_october: -> ::Date
|
|
132
|
+
def end_of_october: -> ::Date
|
|
133
|
+
def all_october: -> ::Range[::Date]
|
|
134
|
+
def beginning_of_october?: -> bool
|
|
135
|
+
def end_of_october?: -> bool
|
|
136
|
+
def in_october?: -> bool
|
|
137
|
+
|
|
138
|
+
def beginning_of_november: -> ::Date
|
|
139
|
+
def end_of_november: -> ::Date
|
|
140
|
+
def all_november: -> ::Range[::Date]
|
|
141
|
+
def beginning_of_november?: -> bool
|
|
142
|
+
def end_of_november?: -> bool
|
|
143
|
+
def in_november?: -> bool
|
|
144
|
+
|
|
145
|
+
def beginning_of_december: -> ::Date
|
|
146
|
+
def end_of_december: -> ::Date
|
|
147
|
+
def all_december: -> ::Range[::Date]
|
|
148
|
+
def beginning_of_december?: -> bool
|
|
149
|
+
def end_of_december?: -> bool
|
|
150
|
+
def in_december?: -> bool
|
|
151
|
+
|
|
152
|
+
def beginning_of_first_quarter: -> ::Date
|
|
153
|
+
def end_of_first_quarter: -> ::Date
|
|
154
|
+
def all_first_quarter: -> ::Range[::Date]
|
|
155
|
+
def beginning_of_first_quarter?: -> bool
|
|
156
|
+
def end_of_first_quarter?: -> bool
|
|
157
|
+
def in_first_quarter?: -> bool
|
|
158
|
+
|
|
159
|
+
def beginning_of_second_quarter: -> ::Date
|
|
160
|
+
def end_of_second_quarter: -> ::Date
|
|
161
|
+
def all_second_quarter: -> ::Range[::Date]
|
|
162
|
+
def beginning_of_second_quarter?: -> bool
|
|
163
|
+
def end_of_second_quarter?: -> bool
|
|
164
|
+
def in_second_quarter?: -> bool
|
|
165
|
+
|
|
166
|
+
def beginning_of_third_quarter: -> ::Date
|
|
167
|
+
def end_of_third_quarter: -> ::Date
|
|
168
|
+
def all_third_quarter: -> ::Range[::Date]
|
|
169
|
+
def beginning_of_third_quarter?: -> bool
|
|
170
|
+
def end_of_third_quarter?: -> bool
|
|
171
|
+
def in_third_quarter?: -> bool
|
|
172
|
+
|
|
173
|
+
def beginning_of_fourth_quarter: -> ::Date
|
|
174
|
+
def end_of_fourth_quarter: -> ::Date
|
|
175
|
+
def all_fourth_quarter: -> ::Range[::Date]
|
|
176
|
+
def beginning_of_fourth_quarter?: -> bool
|
|
177
|
+
def end_of_fourth_quarter?: -> bool
|
|
178
|
+
def in_fourth_quarter?: -> bool
|
|
179
|
+
|
|
180
|
+
def beginning_of_first_half: -> ::Date
|
|
181
|
+
def end_of_first_half: -> ::Date
|
|
182
|
+
def all_first_half: -> ::Range[::Date]
|
|
183
|
+
def beginning_of_first_half?: -> bool
|
|
184
|
+
def end_of_first_half?: -> bool
|
|
185
|
+
def in_first_half?: -> bool
|
|
186
|
+
|
|
187
|
+
def beginning_of_second_half: -> ::Date
|
|
188
|
+
def end_of_second_half: -> ::Date
|
|
189
|
+
def all_second_half: -> ::Range[::Date]
|
|
190
|
+
def beginning_of_second_half?: -> bool
|
|
191
|
+
def end_of_second_half?: -> bool
|
|
192
|
+
def in_second_half?: -> bool
|
|
193
|
+
|
|
194
|
+
def this_quarter_number: -> ::Integer
|
|
195
|
+
def beginning_of_this_quarter: -> ::Date
|
|
196
|
+
def end_of_this_quarter: -> ::Date
|
|
197
|
+
def all_this_quarter: -> ::Range[::Date]
|
|
198
|
+
|
|
199
|
+
def this_half_number: -> ::Integer
|
|
200
|
+
def beginning_of_this_half: -> ::Date
|
|
201
|
+
def end_of_this_half: -> ::Date
|
|
202
|
+
def all_this_half: -> ::Range[::Date]
|
|
203
|
+
|
|
204
|
+
def fiscal_year: -> ::Integer
|
|
205
|
+
def beginning_of_fiscal_year: -> ::Date
|
|
206
|
+
def end_of_fiscal_year: -> ::Date
|
|
207
|
+
def all_fiscal_year: -> ::Range[::Date]
|
|
208
|
+
|
|
209
|
+
def beginning_of_next_quarter: -> ::Date
|
|
210
|
+
def end_of_next_quarter: -> ::Date
|
|
211
|
+
def all_next_quarter: -> ::Range[::Date]
|
|
212
|
+
def beginning_of_prev_quarter: -> ::Date
|
|
213
|
+
def end_of_prev_quarter: -> ::Date
|
|
214
|
+
def all_prev_quarter: -> ::Range[::Date]
|
|
215
|
+
|
|
216
|
+
def beginning_of_next_half: -> ::Date
|
|
217
|
+
def end_of_next_half: -> ::Date
|
|
218
|
+
def all_next_half: -> ::Range[::Date]
|
|
219
|
+
def beginning_of_prev_half: -> ::Date
|
|
220
|
+
def end_of_prev_half: -> ::Date
|
|
221
|
+
def all_prev_half: -> ::Range[::Date]
|
|
222
|
+
|
|
223
|
+
def next_fiscal_year: -> ::Integer
|
|
224
|
+
def beginning_of_next_fiscal_year: -> ::Date
|
|
225
|
+
def end_of_next_fiscal_year: -> ::Date
|
|
226
|
+
def all_next_fiscal_year: -> ::Range[::Date]
|
|
227
|
+
def prev_fiscal_year: -> ::Integer
|
|
228
|
+
def beginning_of_prev_fiscal_year: -> ::Date
|
|
229
|
+
def end_of_prev_fiscal_year: -> ::Date
|
|
230
|
+
def all_prev_fiscal_year: -> ::Range[::Date]
|
|
231
|
+
|
|
232
|
+
# ActiveSupportのメソッドの上書き
|
|
233
|
+
def quarter: -> ::Integer
|
|
234
|
+
def beginning_of_quarter: -> ::Date
|
|
235
|
+
def at_beginning_of_quarter: -> ::Date
|
|
236
|
+
def end_of_quarter: -> ::Date
|
|
237
|
+
def at_end_of_quarter: -> ::Date
|
|
238
|
+
def all_quarter: -> ::Range[::Date]
|
|
239
|
+
def next_quarter: -> ::Date
|
|
240
|
+
def prev_quarter: -> ::Date
|
|
241
|
+
def last_quarter: -> ::Date
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
end
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
module Decentworks
|
|
2
|
+
module DateSupport
|
|
3
|
+
# ::Time / ::DateTime / ::ActiveSupport::TimeWithZone が備えている
|
|
4
|
+
# ActiveSupport(DateAndTime::Calculations)由来のメソッド。
|
|
5
|
+
#
|
|
6
|
+
# TimeExtension のself型として指定することで、モジュール内部での
|
|
7
|
+
# レシーバ省略呼び出しを型検査できるようにする。
|
|
8
|
+
# 戻り値はレシーバと同じクラスになるため、型引数Tで表す。
|
|
9
|
+
interface _DateTimeCalculations[T]
|
|
10
|
+
def year: () -> ::Integer
|
|
11
|
+
def month: () -> ::Integer
|
|
12
|
+
def all_day: () -> ::Range[T]
|
|
13
|
+
def beginning_of_day: () -> T
|
|
14
|
+
def end_of_day: () -> T
|
|
15
|
+
def beginning_of_week: (?untyped start_day) -> T
|
|
16
|
+
def beginning_of_month: () -> T
|
|
17
|
+
def end_of_month: () -> T
|
|
18
|
+
def months_ago: (untyped months) -> T
|
|
19
|
+
def months_since: (untyped months) -> T
|
|
20
|
+
def change: (untyped options) -> T
|
|
21
|
+
def advance: (untyped options) -> T
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# ::Time / ::DateTime / ::ActiveSupport::TimeWithZone に共通の日時拡張
|
|
25
|
+
#
|
|
26
|
+
# 戻り値はレシーバと同じクラスになるため、型引数Tで表す。
|
|
27
|
+
# includeする側で TimeExtension[::Time] のように具体的なクラスを渡す。
|
|
28
|
+
#
|
|
29
|
+
# 型引数の上限をモジュール自身(T < TimeExtension[T])にすることで、
|
|
30
|
+
# Tの値に対してモジュール自身のメソッドと自己型由来のメソッドの両方を呼べる。
|
|
31
|
+
# 戻り値をselfで宣言すると、モジュール内部のレシーバ省略呼び出しがモジュール自身の型に
|
|
32
|
+
# 解決されるため MethodBodyTypeMismatch になるが、型引数であれば一致する。
|
|
33
|
+
module TimeExtension[T < TimeExtension[T]] : _DateTimeCalculations[T]
|
|
34
|
+
module ClassMethods
|
|
35
|
+
def whole_months_elapsed: (from: untyped, to: untyped) -> ::Integer
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.included: (untyped base) -> untyped
|
|
39
|
+
|
|
40
|
+
def beginning_of_this_week: -> T
|
|
41
|
+
def end_of_this_week: -> T
|
|
42
|
+
def all_this_week: -> ::Range[T]
|
|
43
|
+
|
|
44
|
+
def beginning_of_this_month: -> T
|
|
45
|
+
def end_of_this_month: -> T
|
|
46
|
+
def all_this_month: -> ::Range[T]
|
|
47
|
+
|
|
48
|
+
def two_months_ago: -> T
|
|
49
|
+
def three_months_ago: -> T
|
|
50
|
+
def four_months_ago: -> T
|
|
51
|
+
def five_months_ago: -> T
|
|
52
|
+
def six_months_ago: -> T
|
|
53
|
+
def half_year_ago: -> T
|
|
54
|
+
def seven_months_ago: -> T
|
|
55
|
+
def eight_months_ago: -> T
|
|
56
|
+
def nine_months_ago: -> T
|
|
57
|
+
def ten_months_ago: -> T
|
|
58
|
+
def eleven_months_ago: -> T
|
|
59
|
+
|
|
60
|
+
def two_months_since: -> T
|
|
61
|
+
def three_months_since: -> T
|
|
62
|
+
def four_months_since: -> T
|
|
63
|
+
def five_months_since: -> T
|
|
64
|
+
def six_months_since: -> T
|
|
65
|
+
def half_year_since: -> T
|
|
66
|
+
def seven_months_since: -> T
|
|
67
|
+
def eight_months_since: -> T
|
|
68
|
+
def nine_months_since: -> T
|
|
69
|
+
def ten_months_since: -> T
|
|
70
|
+
def eleven_months_since: -> T
|
|
71
|
+
|
|
72
|
+
def beginning_of_january: -> T
|
|
73
|
+
def end_of_january: -> T
|
|
74
|
+
def all_january: -> ::Range[T]
|
|
75
|
+
def beginning_of_january?: -> bool
|
|
76
|
+
def end_of_january?: -> bool
|
|
77
|
+
def in_january?: -> bool
|
|
78
|
+
|
|
79
|
+
def beginning_of_february: -> T
|
|
80
|
+
def end_of_february: -> T
|
|
81
|
+
def all_february: -> ::Range[T]
|
|
82
|
+
def beginning_of_february?: -> bool
|
|
83
|
+
def end_of_february?: -> bool
|
|
84
|
+
def in_february?: -> bool
|
|
85
|
+
|
|
86
|
+
def beginning_of_march: -> T
|
|
87
|
+
def end_of_march: -> T
|
|
88
|
+
def all_march: -> ::Range[T]
|
|
89
|
+
def beginning_of_march?: -> bool
|
|
90
|
+
def end_of_march?: -> bool
|
|
91
|
+
def in_march?: -> bool
|
|
92
|
+
|
|
93
|
+
def beginning_of_april: -> T
|
|
94
|
+
def end_of_april: -> T
|
|
95
|
+
def all_april: -> ::Range[T]
|
|
96
|
+
def beginning_of_april?: -> bool
|
|
97
|
+
def end_of_april?: -> bool
|
|
98
|
+
def in_april?: -> bool
|
|
99
|
+
|
|
100
|
+
def beginning_of_may: -> T
|
|
101
|
+
def end_of_may: -> T
|
|
102
|
+
def all_may: -> ::Range[T]
|
|
103
|
+
def beginning_of_may?: -> bool
|
|
104
|
+
def end_of_may?: -> bool
|
|
105
|
+
def in_may?: -> bool
|
|
106
|
+
|
|
107
|
+
def beginning_of_june: -> T
|
|
108
|
+
def end_of_june: -> T
|
|
109
|
+
def all_june: -> ::Range[T]
|
|
110
|
+
def beginning_of_june?: -> bool
|
|
111
|
+
def end_of_june?: -> bool
|
|
112
|
+
def in_june?: -> bool
|
|
113
|
+
|
|
114
|
+
def beginning_of_july: -> T
|
|
115
|
+
def end_of_july: -> T
|
|
116
|
+
def all_july: -> ::Range[T]
|
|
117
|
+
def beginning_of_july?: -> bool
|
|
118
|
+
def end_of_july?: -> bool
|
|
119
|
+
def in_july?: -> bool
|
|
120
|
+
|
|
121
|
+
def beginning_of_august: -> T
|
|
122
|
+
def end_of_august: -> T
|
|
123
|
+
def all_august: -> ::Range[T]
|
|
124
|
+
def beginning_of_august?: -> bool
|
|
125
|
+
def end_of_august?: -> bool
|
|
126
|
+
def in_august?: -> bool
|
|
127
|
+
|
|
128
|
+
def beginning_of_september: -> T
|
|
129
|
+
def end_of_september: -> T
|
|
130
|
+
def all_september: -> ::Range[T]
|
|
131
|
+
def beginning_of_september?: -> bool
|
|
132
|
+
def end_of_september?: -> bool
|
|
133
|
+
def in_september?: -> bool
|
|
134
|
+
|
|
135
|
+
def beginning_of_october: -> T
|
|
136
|
+
def end_of_october: -> T
|
|
137
|
+
def all_october: -> ::Range[T]
|
|
138
|
+
def beginning_of_october?: -> bool
|
|
139
|
+
def end_of_october?: -> bool
|
|
140
|
+
def in_october?: -> bool
|
|
141
|
+
|
|
142
|
+
def beginning_of_november: -> T
|
|
143
|
+
def end_of_november: -> T
|
|
144
|
+
def all_november: -> ::Range[T]
|
|
145
|
+
def beginning_of_november?: -> bool
|
|
146
|
+
def end_of_november?: -> bool
|
|
147
|
+
def in_november?: -> bool
|
|
148
|
+
|
|
149
|
+
def beginning_of_december: -> T
|
|
150
|
+
def end_of_december: -> T
|
|
151
|
+
def all_december: -> ::Range[T]
|
|
152
|
+
def beginning_of_december?: -> bool
|
|
153
|
+
def end_of_december?: -> bool
|
|
154
|
+
def in_december?: -> bool
|
|
155
|
+
|
|
156
|
+
def beginning_of_first_quarter: -> T
|
|
157
|
+
def end_of_first_quarter: -> T
|
|
158
|
+
def all_first_quarter: -> ::Range[T]
|
|
159
|
+
def beginning_of_first_quarter?: -> bool
|
|
160
|
+
def end_of_first_quarter?: -> bool
|
|
161
|
+
def in_first_quarter?: -> bool
|
|
162
|
+
|
|
163
|
+
def beginning_of_second_quarter: -> T
|
|
164
|
+
def end_of_second_quarter: -> T
|
|
165
|
+
def all_second_quarter: -> ::Range[T]
|
|
166
|
+
def beginning_of_second_quarter?: -> bool
|
|
167
|
+
def end_of_second_quarter?: -> bool
|
|
168
|
+
def in_second_quarter?: -> bool
|
|
169
|
+
|
|
170
|
+
def beginning_of_third_quarter: -> T
|
|
171
|
+
def end_of_third_quarter: -> T
|
|
172
|
+
def all_third_quarter: -> ::Range[T]
|
|
173
|
+
def beginning_of_third_quarter?: -> bool
|
|
174
|
+
def end_of_third_quarter?: -> bool
|
|
175
|
+
def in_third_quarter?: -> bool
|
|
176
|
+
|
|
177
|
+
def beginning_of_fourth_quarter: -> T
|
|
178
|
+
def end_of_fourth_quarter: -> T
|
|
179
|
+
def all_fourth_quarter: -> ::Range[T]
|
|
180
|
+
def beginning_of_fourth_quarter?: -> bool
|
|
181
|
+
def end_of_fourth_quarter?: -> bool
|
|
182
|
+
def in_fourth_quarter?: -> bool
|
|
183
|
+
|
|
184
|
+
def beginning_of_first_half: -> T
|
|
185
|
+
def end_of_first_half: -> T
|
|
186
|
+
def all_first_half: -> ::Range[T]
|
|
187
|
+
def beginning_of_first_half?: -> bool
|
|
188
|
+
def end_of_first_half?: -> bool
|
|
189
|
+
def in_first_half?: -> bool
|
|
190
|
+
|
|
191
|
+
def beginning_of_second_half: -> T
|
|
192
|
+
def end_of_second_half: -> T
|
|
193
|
+
def all_second_half: -> ::Range[T]
|
|
194
|
+
def beginning_of_second_half?: -> bool
|
|
195
|
+
def end_of_second_half?: -> bool
|
|
196
|
+
def in_second_half?: -> bool
|
|
197
|
+
|
|
198
|
+
def this_quarter_number: -> ::Integer
|
|
199
|
+
def beginning_of_this_quarter: -> T
|
|
200
|
+
def end_of_this_quarter: -> T
|
|
201
|
+
def all_this_quarter: -> ::Range[T]
|
|
202
|
+
|
|
203
|
+
def this_half_number: -> ::Integer
|
|
204
|
+
def beginning_of_this_half: -> T
|
|
205
|
+
def end_of_this_half: -> T
|
|
206
|
+
def all_this_half: -> ::Range[T]
|
|
207
|
+
|
|
208
|
+
def fiscal_year: -> ::Integer
|
|
209
|
+
def beginning_of_fiscal_year: -> T
|
|
210
|
+
def end_of_fiscal_year: -> T
|
|
211
|
+
def all_fiscal_year: -> ::Range[T]
|
|
212
|
+
|
|
213
|
+
def beginning_of_next_quarter: -> T
|
|
214
|
+
def end_of_next_quarter: -> T
|
|
215
|
+
def all_next_quarter: -> ::Range[T]
|
|
216
|
+
def beginning_of_prev_quarter: -> T
|
|
217
|
+
def end_of_prev_quarter: -> T
|
|
218
|
+
def all_prev_quarter: -> ::Range[T]
|
|
219
|
+
|
|
220
|
+
def beginning_of_next_half: -> T
|
|
221
|
+
def end_of_next_half: -> T
|
|
222
|
+
def all_next_half: -> ::Range[T]
|
|
223
|
+
def beginning_of_prev_half: -> T
|
|
224
|
+
def end_of_prev_half: -> T
|
|
225
|
+
def all_prev_half: -> ::Range[T]
|
|
226
|
+
|
|
227
|
+
def next_fiscal_year: -> ::Integer
|
|
228
|
+
def beginning_of_next_fiscal_year: -> T
|
|
229
|
+
def end_of_next_fiscal_year: -> T
|
|
230
|
+
def all_next_fiscal_year: -> ::Range[T]
|
|
231
|
+
def prev_fiscal_year: -> ::Integer
|
|
232
|
+
def beginning_of_prev_fiscal_year: -> T
|
|
233
|
+
def end_of_prev_fiscal_year: -> T
|
|
234
|
+
def all_prev_fiscal_year: -> ::Range[T]
|
|
235
|
+
|
|
236
|
+
# ActiveSupportのメソッドの上書き
|
|
237
|
+
def quarter: -> ::Integer
|
|
238
|
+
def beginning_of_quarter: -> T
|
|
239
|
+
def at_beginning_of_quarter: -> T
|
|
240
|
+
def end_of_quarter: -> T
|
|
241
|
+
def at_end_of_quarter: -> T
|
|
242
|
+
def all_quarter: -> ::Range[T]
|
|
243
|
+
def next_quarter: -> T
|
|
244
|
+
def prev_quarter: -> T
|
|
245
|
+
def last_quarter: -> T
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module ActiveSupport
|
|
2
|
+
class TimeWithZone
|
|
3
|
+
include ::Decentworks::DateSupport::TimeExtension[::ActiveSupport::TimeWithZone]
|
|
4
|
+
extend ::Decentworks::DateSupport::TimeExtension::ClassMethods
|
|
5
|
+
|
|
6
|
+
# ::ActiveSupport::TimeWithZone は method_missing で ::Time に委譲しているため
|
|
7
|
+
# gem_rbs_collection の activesupport には定義がない。
|
|
8
|
+
# TimeExtension のself型(_DateTimeCalculations)を満たすために宣言する。
|
|
9
|
+
# change / advance は activesupport 側で定義済みのため、ここには含めない。
|
|
10
|
+
def year: () -> ::Integer
|
|
11
|
+
def month: () -> ::Integer
|
|
12
|
+
def all_day: () -> ::Range[untyped]
|
|
13
|
+
def beginning_of_day: () -> untyped
|
|
14
|
+
def end_of_day: () -> untyped
|
|
15
|
+
def beginning_of_week: (?untyped start_day) -> untyped
|
|
16
|
+
def beginning_of_month: () -> untyped
|
|
17
|
+
def end_of_month: () -> untyped
|
|
18
|
+
def months_ago: (untyped months) -> untyped
|
|
19
|
+
def months_since: (untyped months) -> untyped
|
|
20
|
+
end
|
|
21
|
+
end
|