prezzo 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -8
- data/README.md +1 -1
- data/lib/prezzo/calculator.rb +2 -4
- data/lib/prezzo/context.rb +2 -5
- data/lib/prezzo/explainable.rb +1 -5
- data/lib/prezzo/version.rb +1 -1
- data/prezzo.gemspec +3 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e55520457e5b44bddcadbd3f1398b1ae77dde501
|
4
|
+
data.tar.gz: f725b317c35cf7d64cf08e3c5f81b3d1ebfd2670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f99c37f37e85a8498e476a7073dd415de73949b8f459bc78e0db9d8786f94ee3062521cc192835603749fbf84e34be14bed86feea99c6061a233113e55eb0a0b
|
7
|
+
data.tar.gz: 74a88efd109d6a0a5d8d7fa7c689c43c7811ac1d04f5a6cb4d9e9a8395def25b6ba5a9fbaf4fa951c00e84d3f4099d3177fc6c7737401ed5680106c7354a5c79
|
data/.rubocop.yml
CHANGED
@@ -37,6 +37,9 @@ Metrics/BlockNesting:
|
|
37
37
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
|
38
38
|
Enabled: false
|
39
39
|
|
40
|
+
Metrics/BlockLength:
|
41
|
+
Enabled: false
|
42
|
+
|
40
43
|
Style/CaseEquality:
|
41
44
|
Description: 'Avoid explicit use of the case equality operator(===).'
|
42
45
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
|
@@ -363,20 +366,12 @@ Style/TrailingCommaInArguments:
|
|
363
366
|
Description: 'Checks for trailing comma in argument lists.'
|
364
367
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
365
368
|
EnforcedStyleForMultiline: comma
|
366
|
-
SupportedStyles:
|
367
|
-
- comma
|
368
|
-
- consistent_comma
|
369
|
-
- no_comma
|
370
369
|
Enabled: true
|
371
370
|
|
372
371
|
Style/TrailingCommaInLiteral:
|
373
372
|
Description: 'Checks for trailing comma in array and hash literals.'
|
374
373
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
375
374
|
EnforcedStyleForMultiline: comma
|
376
|
-
SupportedStyles:
|
377
|
-
- comma
|
378
|
-
- consistent_comma
|
379
|
-
- no_comma
|
380
375
|
Enabled: true
|
381
376
|
|
382
377
|
Style/TrivialAccessors:
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Prezzo [![Build Status](https://travis-ci.org/marceloboeira/prezzo.svg?branch=master)](https://travis-ci.org/marceloboeira/prezzo)
|
1
|
+
# Prezzo [![Build Status](https://travis-ci.org/marceloboeira/prezzo.svg?branch=master)](https://travis-ci.org/marceloboeira/prezzo) [![Code Climate](https://codeclimate.com/github/marceloboeira/prezzo.png)](https://codeclimate.com/github/marceloboeira/prezzo)
|
2
2
|
> Toolbox to create complex pricing models
|
3
3
|
|
4
4
|
## Installation
|
data/lib/prezzo/calculator.rb
CHANGED
@@ -10,15 +10,13 @@ module Prezzo
|
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
+
attr_reader :context
|
14
|
+
|
13
15
|
def validated!(context)
|
14
16
|
raise "Empty Context" if context.nil?
|
15
17
|
raise "Invalid Context" if context.respond_to?(:valid?) && !context.valid?
|
16
18
|
|
17
19
|
context
|
18
20
|
end
|
19
|
-
|
20
|
-
def context
|
21
|
-
@context
|
22
|
-
end
|
23
21
|
end
|
24
22
|
end
|
data/lib/prezzo/context.rb
CHANGED
@@ -18,13 +18,10 @@ module Prezzo
|
|
18
18
|
|
19
19
|
def fetch(key, default = nil)
|
20
20
|
if default.nil?
|
21
|
-
|
21
|
+
attributes.fetch(key)
|
22
22
|
else
|
23
|
-
|
24
|
-
value = default if value.nil?
|
23
|
+
attributes.fetch(key, default) || default
|
25
24
|
end
|
26
|
-
|
27
|
-
value
|
28
25
|
end
|
29
26
|
|
30
27
|
def attributes
|
data/lib/prezzo/explainable.rb
CHANGED
@@ -9,13 +9,9 @@ module Prezzo
|
|
9
9
|
module ClassMethods
|
10
10
|
def explain_with(*options)
|
11
11
|
define_method(:explain) do
|
12
|
-
|
13
|
-
|
14
|
-
options.each do |method|
|
12
|
+
options.each_with_object({}) do |method, explanation|
|
15
13
|
explanation[method] = send(method)
|
16
14
|
end
|
17
|
-
|
18
|
-
explanation
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
data/lib/prezzo/version.rb
CHANGED
data/prezzo.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path("../lib", __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require "prezzo/version"
|
@@ -16,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
16
17
|
end
|
17
18
|
spec.require_paths = ["lib"]
|
18
19
|
|
19
|
-
spec.add_dependency "hanami-validations", "1.0
|
20
|
+
spec.add_dependency "hanami-validations", "~> 1.0"
|
20
21
|
spec.add_development_dependency "bundler", "~> 1.13"
|
21
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
23
|
spec.add_development_dependency "rspec", "~> 3.0"
|
@@ -25,4 +26,5 @@ Gem::Specification.new do |spec|
|
|
25
26
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
26
27
|
spec.add_development_dependency "simplecov"
|
27
28
|
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
29
|
+
spec.add_development_dependency "rubocop", "~> 0.48"
|
28
30
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prezzo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Boeira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hanami-validations
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 1.0.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.48'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.48'
|
139
153
|
description: Toolbox to create complex pricing models
|
140
154
|
email:
|
141
155
|
- me@marceloboeira.com
|
@@ -183,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
197
|
version: '0'
|
184
198
|
requirements: []
|
185
199
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.
|
200
|
+
rubygems_version: 2.6.11
|
187
201
|
signing_key:
|
188
202
|
specification_version: 4
|
189
203
|
summary: Toolbox to create complex pricing models
|