roi_calculator 0.3.7 → 1.0.0

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
- SHA1:
3
- metadata.gz: 8abe9ea75aac2649c2a444298c24e21c2bfa96d9
4
- data.tar.gz: 69d88fdd5969f937e7ff45aee9cf99e04edb3f5d
2
+ SHA256:
3
+ metadata.gz: 1fc2392c4737370ff704dbddb3da2cdeb70a242645cef016dd3850eed816e476
4
+ data.tar.gz: d14f14694ae62288b6386c361a3b1c1cccc1b30cf8f8e9700da666712bec0a85
5
5
  SHA512:
6
- metadata.gz: f5dc672a2996187b537a72e861bb0bd005c1415ecfb2b781b6331c8bab67c66d136c36eb716777f373d06d92b5e69e368c7f40d2d239fc3fda9aa54e3e5194e3
7
- data.tar.gz: ee98cf1a647a80f80b78cac0c024ef0ed42f24a73de44ad8587cca6f0bab9f9c26af14e2771bca1660453c2efd94e688cc39408bd2b881dfeaf059e16bca2a87
6
+ metadata.gz: 9611b5bd0bbcb170314b02b79cc315beeb5d2d38661d1722c30d4c941096b128c14c6ddba4a54615ad35bad9427c930e171073eddc0cc10965ee3038dfe8826e
7
+ data.tar.gz: 7060394e2cf7022ac6aebcf8d66405c25f5a6854d53d5e6c31ced1246bbbfdc092956229a2a4d50d506f7428f2cf8f77782ee6922bd08d06ea3f83ef7e877afc
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
- gem 'pry'
data/Gemfile.lock CHANGED
@@ -1,31 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roi_calculator (0.3.7)
4
+ roi_calculator (1.0.0)
5
5
  math_util (~> 0.1.0)
6
6
  memoist (~> 0.15)
7
- work_day (~> 1.0.0)
7
+ work_day (~> 0.3.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (5.2.6)
12
+ activesupport (5.1.6)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 0.7, < 2)
15
15
  minitest (~> 5.1)
16
16
  tzinfo (~> 1.1)
17
- coderay (1.1.3)
18
- concurrent-ruby (1.1.9)
17
+ concurrent-ruby (1.0.5)
19
18
  diff-lcs (1.3)
20
- i18n (1.5.1)
19
+ i18n (1.0.0)
21
20
  concurrent-ruby (~> 1.0)
22
- math_util (0.1.1)
23
- memoist (0.16.2)
24
- method_source (1.0.0)
25
- minitest (5.14.4)
26
- pry (0.13.1)
27
- coderay (~> 1.1)
28
- method_source (~> 1.0)
21
+ math_util (0.1.0)
22
+ memoist (0.16.0)
23
+ minitest (5.11.3)
29
24
  rspec (3.5.0)
30
25
  rspec-core (~> 3.5.0)
31
26
  rspec-expectations (~> 3.5.0)
@@ -40,9 +35,9 @@ GEM
40
35
  rspec-support (~> 3.5.0)
41
36
  rspec-support (3.5.0)
42
37
  thread_safe (0.3.6)
43
- tzinfo (1.2.9)
38
+ tzinfo (1.2.5)
44
39
  thread_safe (~> 0.1)
45
- work_day (1.0.1)
40
+ work_day (0.3.1)
46
41
  activesupport (>= 4.0)
47
42
 
48
43
  PLATFORMS
@@ -50,9 +45,8 @@ PLATFORMS
50
45
 
51
46
  DEPENDENCIES
52
47
  bundler (~> 1.13)
53
- pry
54
48
  roi_calculator!
55
49
  rspec (~> 3.0)
56
50
 
57
51
  BUNDLED WITH
58
- 1.17.3
52
+ 1.16.1
@@ -0,0 +1,22 @@
1
+ # This is a sample build configuration for Ruby.
2
+ # Check our guides at https://confluence.atlassian.com/x/8r-5Mw for more examples.
3
+ # Only use spaces to indent your .yml configuration.
4
+ # -----
5
+ # You can specify a custom docker image from Docker Hub as your build environment.
6
+ image: ruby:2.5.0
7
+
8
+ pipelines:
9
+ default:
10
+ - step:
11
+ caches:
12
+ - bundler
13
+ script: # Modify the commands below to build your repository.
14
+ - gem install rubocop
15
+ - bundle install
16
+ - rspec
17
+ - rubocop
18
+ -
19
+
20
+ definitions:
21
+ caches:
22
+ bundler: ./vendor
@@ -71,7 +71,7 @@ module ROI
71
71
  def to_a
72
72
  dates_with_position.map do |date|
73
73
  if @rentabilities[date]
74
- [date.strftime('%Y-%m-%d'), @rentabilities[date].share - 1]
74
+ [date.strftime("%Y-%m-%d"), @rentabilities[date].share - 1]
75
75
  end
76
76
  end.compact
77
77
  end
@@ -12,26 +12,12 @@ module ROI
12
12
  check_gaps_and_format(adjust_start_date(scoped_start), end_date)
13
13
  end
14
14
 
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)
15
+ def months(amount, date = end_date)
16
+ scoped_start = WorkDay.last_until((date - amount.month).end_of_month)
19
17
  scoped_end = adjust_end_date(date)
20
18
  check_gaps_and_format(scoped_start, scoped_end)
21
19
  end
22
20
 
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)
31
- check_gaps_and_format(scoped_start, scoped_end)
32
- end
33
- alias_method :months, :months_ago
34
-
35
21
  def current_year
36
22
  scoped_start = WorkDay.last_until((end_date - 1.year).end_of_year)
37
23
  format(adjust_start_date(scoped_start), end_date)
data/lib/roi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ROI
2
- VERSION = "0.3.7"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "rspec", "~> 3.0"
22
22
  spec.add_runtime_dependency "memoist", "~> 0.15"
23
23
  spec.add_runtime_dependency "math_util", "~> 0.1.0"
24
- spec.add_runtime_dependency "work_day", "~> 1.0.0"
24
+ spec.add_runtime_dependency "work_day", "~> 0.3.0"
25
25
  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.7
4
+ version: 1.0.0
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-06-22 00:00:00.000000000 Z
11
+ date: 2018-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.0
75
+ version: 0.3.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.0
82
+ version: 0.3.0
83
83
  description:
84
84
  email:
85
85
  - abacha@gmail.com
@@ -96,6 +96,7 @@ files:
96
96
  - Gemfile.lock
97
97
  - LICENSE.txt
98
98
  - README.md
99
+ - bitbucket-pipelines.yml
99
100
  - circle.yml
100
101
  - lib/roi.rb
101
102
  - lib/roi/financial_result.rb
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
125
  version: '0'
125
126
  requirements: []
126
127
  rubyforge_project:
127
- rubygems_version: 2.4.8
128
+ rubygems_version: 2.7.3
128
129
  signing_key:
129
130
  specification_version: 4
130
131
  summary: Rentability and financial calculations