roi_calculator 0.3.2 → 0.3.7
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 +5 -5
- data/Gemfile +1 -0
- data/lib/roi/rentability.rb +1 -1
- data/lib/roi/rentability_periods.rb +17 -3
- data/lib/roi/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 8abe9ea75aac2649c2a444298c24e21c2bfa96d9
|
|
4
|
+
data.tar.gz: 69d88fdd5969f937e7ff45aee9cf99e04edb3f5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5dc672a2996187b537a72e861bb0bd005c1415ecfb2b781b6331c8bab67c66d136c36eb716777f373d06d92b5e69e368c7f40d2d239fc3fda9aa54e3e5194e3
|
|
7
|
+
data.tar.gz: ee98cf1a647a80f80b78cac0c024ef0ed42f24a73de44ad8587cca6f0bab9f9c26af14e2771bca1660453c2efd94e688cc39408bd2b881dfeaf059e16bca2a87
|
data/Gemfile
CHANGED
data/lib/roi/rentability.rb
CHANGED
|
@@ -12,11 +12,25 @@ module ROI
|
|
|
12
12
|
check_gaps_and_format(adjust_start_date(scoped_start), end_date)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
def month(date = end_date)
|
|
16
|
+
return current_month if date == end_date
|
|
17
|
+
|
|
18
|
+
scoped_start = WorkDay.last_until((date - 1.month).end_of_month)
|
|
19
|
+
scoped_end = adjust_end_date(date)
|
|
20
|
+
check_gaps_and_format(scoped_start, scoped_end)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def months_ago(amount, date = end_date)
|
|
24
|
+
return current_month if amount == 1 && date == end_date
|
|
25
|
+
|
|
26
|
+
end_of_month = WorkDay.last_until(date.end_of_month)
|
|
27
|
+
offset = date == end_of_month ? 0 : 1
|
|
28
|
+
|
|
29
|
+
scoped_start = WorkDay.last_until((date - (amount + offset).month).end_of_month)
|
|
30
|
+
scoped_end = adjust_end_date((date - offset.month).end_of_month)
|
|
18
31
|
check_gaps_and_format(scoped_start, scoped_end)
|
|
19
32
|
end
|
|
33
|
+
alias_method :months, :months_ago
|
|
20
34
|
|
|
21
35
|
def current_year
|
|
22
36
|
scoped_start = WorkDay.last_until((end_date - 1.year).end_of_year)
|
data/lib/roi/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roi_calculator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adriano Bacha
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-06-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -123,7 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: '0'
|
|
125
125
|
requirements: []
|
|
126
|
-
|
|
126
|
+
rubyforge_project:
|
|
127
|
+
rubygems_version: 2.4.8
|
|
127
128
|
signing_key:
|
|
128
129
|
specification_version: 4
|
|
129
130
|
summary: Rentability and financial calculations
|