roi_calculator 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: d374c0e5a2f5bc8659091bcdb627b31f9da5bada6bc92de1d3334c532eb704dd
4
- data.tar.gz: d938f830840cbb8cb8de02ac6ebbb092968cf4c912e6b2575aecfe1847ed20e9
2
+ SHA1:
3
+ metadata.gz: 8abe9ea75aac2649c2a444298c24e21c2bfa96d9
4
+ data.tar.gz: 69d88fdd5969f937e7ff45aee9cf99e04edb3f5d
5
5
  SHA512:
6
- metadata.gz: 1be3092e3cb334a65cd96f3763daf591e2c4b57c115ccdded5d4b142849f1bb96c34b420f1f1e78df9a4e8f240bcb73d4f6ddf9a7e7e74dce88de5583e246d49
7
- data.tar.gz: 2f00910f9eb75e1a6a65058aef5b0c4b87a9b82a89a80c59fdc584f180d3a666ea15c62366a1639f857d9aae8ad85d6c8eb752535d32752161b059a1d2b6a0a1
6
+ metadata.gz: f5dc672a2996187b537a72e861bb0bd005c1415ecfb2b781b6331c8bab67c66d136c36eb716777f373d06d92b5e69e368c7f40d2d239fc3fda9aa54e3e5194e3
7
+ data.tar.gz: ee98cf1a647a80f80b78cac0c024ef0ed42f24a73de44ad8587cca6f0bab9f9c26af14e2771bca1660453c2efd94e688cc39408bd2b881dfeaf059e16bca2a87
@@ -23,8 +23,11 @@ module ROI
23
23
  def months_ago(amount, date = end_date)
24
24
  return current_month if amount == 1 && date == end_date
25
25
 
26
- scoped_start = WorkDay.last_until((date - (amount+1).month).end_of_month)
27
- scoped_end = adjust_end_date((date - 1.month).end_of_month)
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)
28
31
  check_gaps_and_format(scoped_start, scoped_end)
29
32
  end
30
33
  alias_method :months, :months_ago
data/lib/roi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ROI
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
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.6
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: 2021-01-14 00:00:00.000000000 Z
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
- rubygems_version: 3.0.8
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