fiscal_year 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -0
- data/CHANGELOG.md +13 -1
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +6 -5
- data/README.md +35 -4
- data/Steepfile +6 -0
- data/lib/fiscal_year/config.rb +3 -1
- data/lib/fiscal_year/half.rb +41 -7
- data/lib/fiscal_year/quarter.rb +14 -4
- data/lib/fiscal_year/version.rb +1 -1
- data/lib/fiscal_year/year_to_date.rb +28 -12
- data/lib/fiscal_year.rb +24 -16
- data/rbs_collection.lock.yaml +89 -0
- data/rbs_collection.yaml +15 -0
- data/sig/fiscal_year/config.rbs +5 -0
- data/sig/fiscal_year/half.rbs +13 -0
- data/sig/fiscal_year/quarter.rbs +16 -0
- data/sig/fiscal_year/year_to_date.rbs +8 -0
- data/sig/fiscal_year.rbs +10 -1
- metadata +10 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cf15774708a32e8499e3228288a15749adf62d98a7dc72ccc31e9cfc0b5b842
|
4
|
+
data.tar.gz: 44dc1c5dc58d257bee352257abae21f5e02412d39d5aef76910ef34036a596bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e38a3d7c476be3d0e2889f608e73b52f04234553f2119fa665dc19143fb0fafadd6ef832dc4c42527096e7a402136992a4e2a4e5222109364522c32fca1de1a
|
7
|
+
data.tar.gz: 591f594009aa1cfb7595a3c18720c8d7f88974a7510252f870f981d5518ef296ebdd2fb8b5eb8397bc040c263fc33d4ae0acd09cc76993c4f52731eac15dce36
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.6
|
3
|
+
Exclude:
|
4
|
+
- 'Steepfile'
|
5
|
+
- 'vendor/**/*'
|
6
|
+
NewCops: enable
|
3
7
|
|
4
8
|
Style/StringLiterals:
|
5
9
|
Enabled: true
|
@@ -11,3 +15,10 @@ Style/StringLiteralsInInterpolation:
|
|
11
15
|
|
12
16
|
Layout/LineLength:
|
13
17
|
Max: 120
|
18
|
+
|
19
|
+
Style/Documentation:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Metrics/BlockLength:
|
23
|
+
Exclude:
|
24
|
+
- 'spec/**/*'
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
## [
|
1
|
+
## [0.3.0] - 2023-04-23
|
2
|
+
- add rbs
|
3
|
+
- fit to rbs
|
4
|
+
|
5
|
+
- improve workflow
|
6
|
+
- add dependabot
|
7
|
+
- add test coverage
|
8
|
+
|
9
|
+
## [0.2.0] - 2023-03-16
|
10
|
+
- add test
|
11
|
+
- fit to rubocop
|
12
|
+
|
13
|
+
- fix some methods
|
2
14
|
|
3
15
|
## [0.1.0] - 2023-03-14
|
4
16
|
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -39,7 +39,7 @@ This Code of Conduct applies within all community spaces, and also applies when
|
|
39
39
|
|
40
40
|
## Enforcement
|
41
41
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at tk.music.jpn@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
43
|
|
44
44
|
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
45
|
|
data/Gemfile
CHANGED
@@ -5,8 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
# Specify your gem's dependencies in fiscal_year.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
gem "rspec"
|
11
|
-
|
12
|
-
gem "
|
8
|
+
group :development do
|
9
|
+
gem "rake"
|
10
|
+
gem "rspec"
|
11
|
+
gem "rubocop"
|
12
|
+
gem "simplecov"
|
13
|
+
end
|
data/README.md
CHANGED
@@ -1,9 +1,26 @@
|
|
1
|
+
![build badge](https://github.com/TsubasaKawajiri/fiscal_year/actions/workflows/test.yml/badge.svg?branch=master)
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/fiscal_year.svg)](https://badge.fury.io/rb/fiscal_year)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/39fdb48501c5f53235a9/maintainability)](https://codeclimate.com/github/TsubasaKawajiri/fiscal_year/maintainability)
|
4
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/39fdb48501c5f53235a9/test_coverage)](https://codeclimate.com/github/TsubasaKawajiri/fiscal_year/test_coverage)
|
5
|
+
|
1
6
|
# FiscalYear
|
2
7
|
|
8
|
+
FiscalYear is calculates half-year, quarter-year, and YTD figures.
|
9
|
+
It can take in a year's numerical value or a year and month and return the results as a Range.
|
10
|
+
|
11
|
+
Additionally, it allows for the customization of the starting month of the fiscal period.
|
3
12
|
|
4
13
|
## Installation
|
5
14
|
|
6
|
-
|
15
|
+
```
|
16
|
+
gem 'fiscal_year'
|
17
|
+
```
|
18
|
+
|
19
|
+
then,
|
20
|
+
|
21
|
+
```
|
22
|
+
bundle install
|
23
|
+
```
|
7
24
|
|
8
25
|
## Usage
|
9
26
|
|
@@ -12,6 +29,20 @@ require 'fiscal_year'
|
|
12
29
|
|
13
30
|
FiscalYear.quarters
|
14
31
|
=> [[4, 5, 6], [7, 8, 9], [10, 11, 12], [1, 2, 3]]
|
32
|
+
|
33
|
+
date = Date.parse('2023/08/01')
|
34
|
+
|
35
|
+
# get current Half range
|
36
|
+
FiscalYear::Half.range_by(date)
|
37
|
+
=> Sat, 01 Apr 2023..Sat, 30 Sep 2023
|
38
|
+
|
39
|
+
# get current quarter range
|
40
|
+
FiscalYear::Quarter.range_by(date)
|
41
|
+
=> Sat, 01 Jul 2023..Sat, 30 Sep 2023
|
42
|
+
|
43
|
+
# get year to date
|
44
|
+
FiscalYear::YearToDate.range_by(date)
|
45
|
+
=> Sat, 01 Apr 2023..Thu, 31 Aug 2023
|
15
46
|
```
|
16
47
|
|
17
48
|
configure start month
|
@@ -27,11 +58,11 @@ configure start month
|
|
27
58
|
|
28
59
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
60
|
|
30
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
61
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
31
62
|
|
32
63
|
## Contributing
|
33
64
|
|
34
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
65
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/TsubasaKawajiri/fiscal_year. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/TsubasaKawajiri/fiscal_year/blob/master/CODE_OF_CONDUCT.md).
|
35
66
|
|
36
67
|
## License
|
37
68
|
|
@@ -39,4 +70,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
39
70
|
|
40
71
|
## Code of Conduct
|
41
72
|
|
42
|
-
Everyone interacting in the FiscalYear project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
73
|
+
Everyone interacting in the FiscalYear project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/TsubasaKawajiri/fiscal_year/blob/master/CODE_OF_CONDUCT.md).
|
data/Steepfile
ADDED
data/lib/fiscal_year/config.rb
CHANGED
data/lib/fiscal_year/half.rb
CHANGED
@@ -3,13 +3,18 @@
|
|
3
3
|
module FiscalYear
|
4
4
|
class Half
|
5
5
|
class << self
|
6
|
-
|
7
6
|
def first
|
8
|
-
FiscalYear.halfs.first
|
7
|
+
first = FiscalYear.halfs.first
|
8
|
+
return first if first.is_a? Array
|
9
|
+
|
10
|
+
[]
|
9
11
|
end
|
10
12
|
|
11
13
|
def second
|
12
|
-
FiscalYear.halfs.second
|
14
|
+
second = FiscalYear.halfs.second
|
15
|
+
return second if second.is_a? Array
|
16
|
+
|
17
|
+
[]
|
13
18
|
end
|
14
19
|
|
15
20
|
def first?(month)
|
@@ -21,22 +26,51 @@ module FiscalYear
|
|
21
26
|
end
|
22
27
|
|
23
28
|
def first_range_by(year)
|
24
|
-
Date
|
29
|
+
# care Date#parse 2 digit year auto complete.
|
30
|
+
# 99 + 1 = 100, but expect 2000 this context.
|
31
|
+
year = 1999 if year == 99
|
32
|
+
end_month = first.last
|
33
|
+
raise StandardError if end_month.nil?
|
34
|
+
|
35
|
+
end_year = normalize_year_by_month(year, end_month)
|
36
|
+
|
37
|
+
Date.parse("#{year}/#{first.first}/01")..Date.parse("#{end_year}/#{end_month}/01").end_of_month
|
25
38
|
end
|
26
39
|
|
27
40
|
def second_range_by(year)
|
28
|
-
Date
|
41
|
+
# care Date#parse 2 digit year auto complete.
|
42
|
+
# 99 + 1 = 100, but expect 2000 this context.
|
43
|
+
year = 1999 if year == 99
|
44
|
+
first_month = second.first
|
45
|
+
end_month = second.last
|
46
|
+
raise StandardError if first_month.nil? || end_month.nil?
|
47
|
+
|
48
|
+
start_year = normalize_year_by_month(year, first_month)
|
49
|
+
end_year = normalize_year_by_month(year, end_month)
|
50
|
+
|
51
|
+
Date.parse("#{start_year}/#{first_month}/01")..Date.parse("#{end_year}/#{end_month}/01").end_of_month
|
29
52
|
end
|
30
53
|
|
31
54
|
def range_by(date)
|
32
55
|
month = date.month
|
33
56
|
year = date.year
|
57
|
+
# if passed crossed year value, normalize to not crossed year value
|
58
|
+
year -= 1 if FiscalYear.cross_year_month?(month)
|
59
|
+
|
60
|
+
first?(month) ? first_range_by(year) : second_range_by(year)
|
61
|
+
end
|
62
|
+
|
63
|
+
def normalize_year_by_month(year, month)
|
34
64
|
if FiscalYear.cross_year_month?(month)
|
35
|
-
|
65
|
+
year + 1
|
36
66
|
else
|
37
|
-
|
67
|
+
year
|
38
68
|
end
|
39
69
|
end
|
70
|
+
|
71
|
+
def cross_year_in_half?(half)
|
72
|
+
FiscalYear.cross_year? && half.any? { |month| month == 12 }
|
73
|
+
end
|
40
74
|
end
|
41
75
|
end
|
42
76
|
end
|
data/lib/fiscal_year/quarter.rb
CHANGED
@@ -26,18 +26,28 @@ module FiscalYear
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def months(month)
|
29
|
-
FiscalYear.quarters.find { |a| a.include?(month) }
|
29
|
+
months = FiscalYear.quarters.find { |a| a.include?(month) }
|
30
|
+
raise ::StandardError if months.nil?
|
31
|
+
|
32
|
+
months
|
30
33
|
end
|
31
34
|
|
32
35
|
def range_by(date)
|
33
36
|
year = date.year
|
34
|
-
|
37
|
+
this_quater = months(date.month)
|
38
|
+
last_year = cross_year_in_quarter?(this_quater) ? year + 1 : year
|
35
39
|
|
36
|
-
Date.parse("#{year}/#{
|
40
|
+
Date.parse("#{year}/#{this_quater.first}/01")..Date.parse("#{last_year}/#{this_quater.last}/01").end_of_month
|
37
41
|
end
|
38
42
|
|
39
43
|
def quater_num(month)
|
40
|
-
|
44
|
+
rindex = FiscalYear.quarters.rindex(months(month))
|
45
|
+
|
46
|
+
rindex.nil? ? 0 : (rindex + 1)
|
47
|
+
end
|
48
|
+
|
49
|
+
def cross_year_in_quarter?(quarter)
|
50
|
+
FiscalYear.cross_year? && quarter.any? { |month| month == 12 }
|
41
51
|
end
|
42
52
|
end
|
43
53
|
end
|
data/lib/fiscal_year/version.rb
CHANGED
@@ -8,17 +8,21 @@ module FiscalYear
|
|
8
8
|
month = date.month
|
9
9
|
|
10
10
|
if FiscalYear.cross_year_month?(month)
|
11
|
-
Date.parse("#{year - 1}/#{FiscalYear.config.start_month}")..date.end_of_month.to_date
|
11
|
+
Date.parse("#{year - 1}/#{FiscalYear.config.start_month}/01")..date.end_of_month.to_date
|
12
12
|
else
|
13
|
-
Date.parse("#{year}/#{FiscalYear.config.start_month}")..date.end_of_month.to_date
|
13
|
+
Date.parse("#{year}/#{FiscalYear.config.start_month}/01")..date.end_of_month.to_date
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
# TODO: fit to Abc size
|
18
|
+
def year_month_pairs(date) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
18
19
|
month = date.month
|
20
|
+
month_index = FiscalYear.months.index(month)
|
21
|
+
months = FiscalYear.months[(0..month_index)]
|
22
|
+
raise StandardError if months.nil?
|
19
23
|
|
20
24
|
pair = []
|
21
|
-
[date.year].product(
|
25
|
+
[date.year].product(months).each do |e|
|
22
26
|
pair << if FiscalYear.cross_year_month?(month)
|
23
27
|
(FiscalYear.cross_year_month?(e.second) ? e : [e.first - 1, e.second])
|
24
28
|
else
|
@@ -29,24 +33,36 @@ module FiscalYear
|
|
29
33
|
pair
|
30
34
|
end
|
31
35
|
|
32
|
-
|
36
|
+
# TODO: fit to Abc size
|
37
|
+
def half_range_by(date) # rubocop:disable Metrics/AbcSize
|
33
38
|
year = date.year
|
34
39
|
month = date.month
|
35
40
|
|
36
|
-
|
41
|
+
if Half.first?(month)
|
42
|
+
return (Date.parse("#{FiscalYear.cross_year_month?(month) ? year - 1 : year}/#{Half.first.first}/01")..
|
43
|
+
date.end_of_month.to_date
|
44
|
+
)
|
45
|
+
end
|
37
46
|
|
38
|
-
Date.parse(
|
47
|
+
Date.parse(
|
48
|
+
"#{FiscalYear::Half.cross_year_in_half?(Half.second) ? year - 1 : year}/#{Half.second.first}"
|
49
|
+
)..date.end_of_month.to_date
|
39
50
|
end
|
40
51
|
|
41
52
|
def quarter_range_by(date)
|
42
53
|
year = date.year
|
43
54
|
month = date.month
|
44
55
|
|
45
|
-
%i[first? second? third? fourth?]
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
quarter_method = %i[first? second? third? fourth?]
|
57
|
+
.filter { |method_name| FiscalYear::Quarter.public_send(method_name, month) }
|
58
|
+
.first.to_s.gsub("?", "").to_sym
|
59
|
+
|
60
|
+
quarter = Quarter.public_send(quarter_method)
|
61
|
+
|
62
|
+
(
|
63
|
+
Date.parse("#{FiscalYear.cross_year_month?(month) ? year - 1 : year}/#{quarter.first}/01")..
|
64
|
+
date.end_of_month.to_date
|
65
|
+
)
|
50
66
|
end
|
51
67
|
end
|
52
68
|
end
|
data/lib/fiscal_year.rb
CHANGED
@@ -2,46 +2,54 @@
|
|
2
2
|
|
3
3
|
require_relative "fiscal_year/version"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
5
|
+
require "fiscal_year/half"
|
6
|
+
require "fiscal_year/quarter"
|
7
|
+
require "fiscal_year/year_to_date"
|
8
|
+
require "fiscal_year/config"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
10
|
+
require "active_support"
|
11
|
+
require "active_support/core_ext"
|
12
12
|
|
13
13
|
module FiscalYear
|
14
|
-
|
14
|
+
# @type ivar @config: FiscalYear::Config
|
15
|
+
@config ||= FiscalYear::Config.new
|
15
16
|
class << self
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
def configure(&block)
|
21
|
-
yield(@@config) if block_given?
|
17
|
+
attr_reader :config
|
18
|
+
|
19
|
+
def configure
|
20
|
+
yield(@config) if block_given?
|
22
21
|
end
|
23
22
|
|
24
23
|
def cross_year_month?(month)
|
25
24
|
cross_year_months.include?(month)
|
26
25
|
end
|
27
|
-
|
26
|
+
|
28
27
|
def cross_year?
|
29
28
|
months.rindex(1) != 0
|
30
29
|
end
|
31
30
|
|
32
31
|
def months
|
33
|
-
(1..12).to_a.tap { |arr| arr.concat(arr.shift(
|
32
|
+
(1..12).to_a.tap { |arr| arr.concat(arr.shift(@config.start_month - 1)) }
|
34
33
|
end
|
35
34
|
|
36
35
|
def cross_year_months
|
37
|
-
|
36
|
+
return [] if @config.start_month == 1
|
37
|
+
|
38
|
+
rindex = months.rindex(1).to_i
|
39
|
+
|
40
|
+
m = months.slice(rindex, months.length)
|
41
|
+
raise StandardError if m.nil?
|
42
|
+
|
43
|
+
m
|
38
44
|
end
|
39
45
|
|
40
46
|
def halfs
|
47
|
+
# @type self: singleton(FiscalYear)
|
41
48
|
months.in_groups(2)
|
42
49
|
end
|
43
50
|
|
44
51
|
def quarters
|
52
|
+
# @type self: singleton(FiscalYear)
|
45
53
|
months.in_groups(4)
|
46
54
|
end
|
47
55
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
---
|
2
|
+
sources:
|
3
|
+
- name: ruby/gem_rbs_collection
|
4
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
5
|
+
revision: main
|
6
|
+
repo_dir: gems
|
7
|
+
path: ".gem_rbs_collection"
|
8
|
+
gems:
|
9
|
+
- name: activesupport
|
10
|
+
version: '7.0'
|
11
|
+
source:
|
12
|
+
type: git
|
13
|
+
name: ruby/gem_rbs_collection
|
14
|
+
revision: 641dae8a456dc964cf7e447b7d994c709c7e5f96
|
15
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
16
|
+
repo_dir: gems
|
17
|
+
- name: ast
|
18
|
+
version: '2.4'
|
19
|
+
source:
|
20
|
+
type: git
|
21
|
+
name: ruby/gem_rbs_collection
|
22
|
+
revision: 641dae8a456dc964cf7e447b7d994c709c7e5f96
|
23
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
24
|
+
repo_dir: gems
|
25
|
+
- name: concurrent-ruby
|
26
|
+
version: '1.1'
|
27
|
+
source:
|
28
|
+
type: git
|
29
|
+
name: ruby/gem_rbs_collection
|
30
|
+
revision: 641dae8a456dc964cf7e447b7d994c709c7e5f96
|
31
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
32
|
+
repo_dir: gems
|
33
|
+
- name: i18n
|
34
|
+
version: '1.10'
|
35
|
+
source:
|
36
|
+
type: git
|
37
|
+
name: ruby/gem_rbs_collection
|
38
|
+
revision: 641dae8a456dc964cf7e447b7d994c709c7e5f96
|
39
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
40
|
+
repo_dir: gems
|
41
|
+
- name: json
|
42
|
+
version: '0'
|
43
|
+
source:
|
44
|
+
type: stdlib
|
45
|
+
- name: minitest
|
46
|
+
version: '0'
|
47
|
+
source:
|
48
|
+
type: stdlib
|
49
|
+
- name: parallel
|
50
|
+
version: '1.20'
|
51
|
+
source:
|
52
|
+
type: git
|
53
|
+
name: ruby/gem_rbs_collection
|
54
|
+
revision: 641dae8a456dc964cf7e447b7d994c709c7e5f96
|
55
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
56
|
+
repo_dir: gems
|
57
|
+
- name: rainbow
|
58
|
+
version: '3.0'
|
59
|
+
source:
|
60
|
+
type: git
|
61
|
+
name: ruby/gem_rbs_collection
|
62
|
+
revision: 641dae8a456dc964cf7e447b7d994c709c7e5f96
|
63
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
64
|
+
repo_dir: gems
|
65
|
+
- name: date
|
66
|
+
version: '0'
|
67
|
+
source:
|
68
|
+
type: stdlib
|
69
|
+
- name: logger
|
70
|
+
version: '0'
|
71
|
+
source:
|
72
|
+
type: stdlib
|
73
|
+
- name: monitor
|
74
|
+
version: '0'
|
75
|
+
source:
|
76
|
+
type: stdlib
|
77
|
+
- name: mutex_m
|
78
|
+
version: '0'
|
79
|
+
source:
|
80
|
+
type: stdlib
|
81
|
+
- name: singleton
|
82
|
+
version: '0'
|
83
|
+
source:
|
84
|
+
type: stdlib
|
85
|
+
- name: time
|
86
|
+
version: '0'
|
87
|
+
source:
|
88
|
+
type: stdlib
|
89
|
+
gemfile_lock_path: Gemfile.lock
|
data/rbs_collection.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Download sources
|
2
|
+
sources:
|
3
|
+
- name: ruby/gem_rbs_collection
|
4
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
5
|
+
revision: main
|
6
|
+
repo_dir: gems
|
7
|
+
|
8
|
+
# A directory to install the downloaded RBSs
|
9
|
+
path: .gem_rbs_collection
|
10
|
+
|
11
|
+
gems:
|
12
|
+
# Skip loading rbs gem's RBS.
|
13
|
+
# It's unnecessary if you don't use rbs as a library.
|
14
|
+
- name: rbs
|
15
|
+
ignore: true
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module FiscalYear
|
2
|
+
class Half
|
3
|
+
def self.first: () -> Array[Integer] | -> Array[untyped]
|
4
|
+
def self.second: () -> Array[Integer] | -> Array[untyped]
|
5
|
+
def self.first?: (Integer) -> bool
|
6
|
+
def self.second?: (Integer) -> bool
|
7
|
+
def self.first_range_by: (Integer) -> Range[Date]
|
8
|
+
def self.second_range_by: (Integer) -> Range[Date]
|
9
|
+
def self.range_by: (Date) -> Range[Date]
|
10
|
+
def self.normalize_year_by_month: (Integer, Integer) -> Integer
|
11
|
+
def self.cross_year_in_half?: (Array[Integer]) -> bool
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module FiscalYear
|
2
|
+
class Quarter
|
3
|
+
def self.first: () -> Array[Integer]
|
4
|
+
def self.second: () -> Array[Integer]
|
5
|
+
def self.third: () -> Array[Integer]
|
6
|
+
def self.fourth: () -> Array[Integer]
|
7
|
+
def self.first?: (Integer) -> bool
|
8
|
+
def self.second?: (Integer) -> bool
|
9
|
+
def self.third?: (Integer) -> bool
|
10
|
+
def self.fourth?: (Integer) -> bool
|
11
|
+
def self.months: (Integer) -> Array[Integer]
|
12
|
+
def self.range_by: (Date) -> Range[Date]
|
13
|
+
def self.quarter_num: (Integer) -> Integer
|
14
|
+
def self. cross_year_in_quarter?: (Array[Integer]) -> bool
|
15
|
+
end
|
16
|
+
end
|
data/sig/fiscal_year.rbs
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
module FiscalYear
|
2
2
|
VERSION: String
|
3
|
-
|
3
|
+
@config: FiscalYear::Config
|
4
|
+
|
5
|
+
attr_reader self.config: FiscalYear::Config
|
6
|
+
def self.configure: () { (FiscalYear::Config) -> void } -> void | -> void
|
7
|
+
def self.cross_year_month?: (Integer) -> bool
|
8
|
+
def self.cross_year?: () -> bool
|
9
|
+
def self.months: -> Array[Integer]
|
10
|
+
def self.cross_year_months: () -> Array[Integer]
|
11
|
+
def self.halfs: () -> [Array[Integer], Array[Integer]]
|
12
|
+
def self.quarters: () -> [Array[Integer], Array[Integer], Array[Integer], Array[Integer]]
|
4
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiscal_year
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsubasa Kawajiri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,34 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
27
|
description: fiscal year, quarter, year to date calculate
|
56
28
|
email:
|
57
29
|
- tk.music.jpn@gmail.com
|
@@ -67,13 +39,20 @@ files:
|
|
67
39
|
- LICENSE.txt
|
68
40
|
- README.md
|
69
41
|
- Rakefile
|
42
|
+
- Steepfile
|
70
43
|
- lib/fiscal_year.rb
|
71
44
|
- lib/fiscal_year/config.rb
|
72
45
|
- lib/fiscal_year/half.rb
|
73
46
|
- lib/fiscal_year/quarter.rb
|
74
47
|
- lib/fiscal_year/version.rb
|
75
48
|
- lib/fiscal_year/year_to_date.rb
|
49
|
+
- rbs_collection.lock.yaml
|
50
|
+
- rbs_collection.yaml
|
76
51
|
- sig/fiscal_year.rbs
|
52
|
+
- sig/fiscal_year/config.rbs
|
53
|
+
- sig/fiscal_year/half.rbs
|
54
|
+
- sig/fiscal_year/quarter.rbs
|
55
|
+
- sig/fiscal_year/year_to_date.rbs
|
77
56
|
homepage: https://github.com/TsubasaKawajiri/fiscal_year
|
78
57
|
licenses:
|
79
58
|
- MIT
|
@@ -82,6 +61,7 @@ metadata:
|
|
82
61
|
homepage_uri: https://github.com/TsubasaKawajiri/fiscal_year
|
83
62
|
source_code_uri: https://github.com/TsubasaKawajiri/fiscal_year
|
84
63
|
changelog_uri: https://github.com/TsubasaKawajiri/fiscal_year/CHANGEROG.md
|
64
|
+
rubygems_mfa_required: 'true'
|
85
65
|
post_install_message:
|
86
66
|
rdoc_options: []
|
87
67
|
require_paths:
|