slide_rule 0.2.1 → 0.2.2

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
2
  SHA1:
3
- metadata.gz: f3035bfd6643001929a84db47e8de72911901eb6
4
- data.tar.gz: 0a2f570fb3371d5814a3247aea005676525e69aa
3
+ metadata.gz: ad1a7e41a1a14345029655bb3ede3e7c274fc885
4
+ data.tar.gz: f164640543e98e706e5067abca94133350abe771
5
5
  SHA512:
6
- metadata.gz: 282666dafc39dad85c6850c460e7bf2babe7ad3b38b54469ae0df5b91a9802400f3ed50626507712cc7a5afa1173add644ec229704133fe5b60858fa986b2d12
7
- data.tar.gz: 8c167275bb751444636e25fd1c197566e3dde22f88d30a30f8d9a670a786f897252991429ade2e37efa766efbe5c9dfd3982c73d896780df61d6f869e075b92d
6
+ metadata.gz: 29f83acc7009c6473696870459120a1348074d960d7e053191153dd539c2d428545111a881f06838c84193765504b7855e79f8b703c45fb894fa1d65e4de260b
7
+ data.tar.gz: ae9223f7203d59dd3f8e511c06579c93c8c520b5c7f184bddb7ae4eb991e1f40d13c3e6c88d59b8ca45ae7f1eb7fe344064d0c1262c48e2553d2c7202ccbf82b
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ inherit_from:
2
+ - config/rubocop/disabled.yml
1
3
  AllCops:
2
4
  DisplayCopNames: true
3
5
  Exclude:
@@ -0,0 +1,4 @@
1
+ Style/PredicateName:
2
+ Description: 'Check the names of predicate methods.'
3
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
4
+ Enabled: false
@@ -85,10 +85,10 @@ module SlideRule
85
85
  def get_calculator(calculator)
86
86
  return calculator.new if calculator.is_a?(Class)
87
87
 
88
- klass_name = "#{calculator.to_s.split('_').collect(&:capitalize).join}"
88
+ klass_name = calculator.to_s.split('_').collect(&:capitalize).join.to_s
89
89
  klass = begin
90
90
  ::SlideRule::DistanceCalculators.const_get(klass_name)
91
- rescue(::NameError)
91
+ rescue ::NameError
92
92
  nil
93
93
  end
94
94
 
@@ -8,6 +8,7 @@ module SlideRule
8
8
  # Does not take into account the number of days in the actual month being considered.
9
9
  #
10
10
  def calculate(first, second)
11
+ return nil if first.nil? || second.nil?
11
12
  first = cleanse_date(first)
12
13
  second = cleanse_date(second)
13
14
 
@@ -1,3 +1,3 @@
1
1
  module SlideRule
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'.freeze
3
3
  end
@@ -75,23 +75,23 @@ describe ::SlideRule::DistanceCalculator do
75
75
  ::SlideRule::DistanceCalculator.new(
76
76
  description: {
77
77
  weight: 0.80,
78
- type: :levenshtein
78
+ calculator: :levenshtein
79
79
  },
80
80
  date: {
81
81
  weight: 0.90,
82
- type: :day_of_month
82
+ calculator: :day_of_month
83
83
  }
84
84
  )
85
85
  end
86
86
 
87
- it 'returns true if there is a match' do
87
+ it 'returns true if there is a match' do
88
88
  example_1 = ExampleTransaction.new(description: 'Wells Fargo Dealer SVC', date: '2015-06-17')
89
89
  example_2 = ExampleTransaction.new(description: 'Wells Fargo Dealer SVC', date: '2015-06-17')
90
90
 
91
91
  expect(calculator.is_match?(example_1, example_2, 0.2)).to be(true)
92
92
  end
93
93
 
94
- it 'returns false if there is a match' do
94
+ it 'returns false if there is a match' do
95
95
  example_1 = ExampleTransaction.new(description: 'Wells Fargo Dealer SVC', date: '2015-06-17')
96
96
  example_2 = ExampleTransaction.new(description: 'Taco Bell', date: '2015-06-17')
97
97
 
@@ -191,7 +191,7 @@ describe ::SlideRule::DistanceCalculator do
191
191
  rules = {
192
192
  description: {
193
193
  weight: 1.0,
194
- calculator: CustomCalc
194
+ type: CustomCalc
195
195
  },
196
196
  name: {
197
197
  weight: 1.0,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slide_rule
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mattnichols
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-11 00:00:00.000000000 Z
12
+ date: 2016-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  name: vladlev
@@ -22,13 +22,13 @@ dependencies:
22
22
  type: :runtime
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10'
34
34
  name: rake
@@ -36,13 +36,13 @@ dependencies:
36
36
  type: :development
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '10'
42
42
  - !ruby/object:Gem::Dependency
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  name: pry
@@ -50,13 +50,13 @@ dependencies:
50
50
  type: :development
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3'
62
62
  name: rspec
@@ -64,13 +64,13 @@ dependencies:
64
64
  type: :development
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '3'
70
70
  - !ruby/object:Gem::Dependency
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  name: rubocop
@@ -78,7 +78,7 @@ dependencies:
78
78
  type: :development
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  description: Calculates the distance between 2 arbitrary objects using specified fields and algorithms.
@@ -88,14 +88,15 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - .gitignore
92
- - .rubocop.yml
93
- - .travis.yml
91
+ - ".gitignore"
92
+ - ".rubocop.yml"
93
+ - ".travis.yml"
94
94
  - CODE_OF_CONDUCT.md
95
95
  - Gemfile
96
96
  - LICENSE
97
97
  - README.md
98
98
  - Rakefile
99
+ - config/rubocop/disabled.yml
99
100
  - lib/slide_rule.rb
100
101
  - lib/slide_rule/distance_calculator.rb
101
102
  - lib/slide_rule/distance_calculators/day_of_month.rb
@@ -118,12 +119,12 @@ require_paths:
118
119
  - lib
119
120
  required_ruby_version: !ruby/object:Gem::Requirement
120
121
  requirements:
121
- - - '>='
122
+ - - ">="
122
123
  - !ruby/object:Gem::Version
123
124
  version: '0'
124
125
  required_rubygems_version: !ruby/object:Gem::Requirement
125
126
  requirements:
126
- - - '>='
127
+ - - ">="
127
128
  - !ruby/object:Gem::Version
128
129
  version: '0'
129
130
  requirements: []