dry-logic 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +23 -0
- data/.travis.yml +15 -6
- data/CHANGELOG.md +12 -0
- data/Gemfile +2 -1
- data/dry-logic.gemspec +1 -1
- data/lib/dry/logic/predicates.rb +8 -8
- data/lib/dry/logic/version.rb +1 -1
- data/spec/spec_helper.rb +4 -7
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8706db20bc46c7c3b7f20fe03bfbc0068e9be304
|
4
|
+
data.tar.gz: 6b07fca8b0cdccdbf87e7cd2d0287f04383ab155
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b563117d6c9ecc31d37e3be476064f020b640b6208087a658cb329b0186ace8de62d7a5795a0c8578890ff131c2859fd0cc934a2c9080f6f1024daa1db6c988
|
7
|
+
data.tar.gz: 78f7d1b67309c6df1a4b027b32f5200c74daa676d8fa76ab7086f5a84ff91cb8e970623805eca85ff150e6f9ac0a01a43244e26e57aadd0fe3546927bdafef9d
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
engines:
|
2
|
+
rubocop:
|
3
|
+
enabled: true
|
4
|
+
checks:
|
5
|
+
Rubocop/Metrics/LineLength:
|
6
|
+
enabled: true
|
7
|
+
max: 100
|
8
|
+
Rubocop/Style/Documentation:
|
9
|
+
enabled: false
|
10
|
+
Rubocop/Lint/HandleExceptions:
|
11
|
+
enabled: true
|
12
|
+
exclude:
|
13
|
+
- rakelib/*.rake
|
14
|
+
Rubocop/Style/FileName:
|
15
|
+
enabled: true
|
16
|
+
exclude:
|
17
|
+
- 'lib/dry-logic.rb'
|
18
|
+
ratings:
|
19
|
+
paths:
|
20
|
+
- lib/**/*.rb
|
21
|
+
exclude_paths:
|
22
|
+
- spec/**/*
|
23
|
+
- examples/**/*
|
data/.travis.yml
CHANGED
@@ -1,22 +1,31 @@
|
|
1
1
|
language: ruby
|
2
|
+
dist: trusty
|
2
3
|
sudo: false
|
3
4
|
cache: bundler
|
4
5
|
bundler_args: --without console tools
|
5
6
|
script:
|
6
7
|
- bundle exec rake spec
|
8
|
+
before_install:
|
9
|
+
- gem update --system
|
10
|
+
- rvm @global do gem uninstall bundler -a -x
|
11
|
+
- rvm @global do gem install bundler -v 1.13.7
|
12
|
+
after_success:
|
13
|
+
# Send coverage report from the job #1 == current MRI release
|
14
|
+
- '[ "${TRAVIS_JOB_NUMBER#*.}" = "1" ] && [ "$TRAVIS_BRANCH" = "master" ] && bundle exec codeclimate-test-reporter'
|
7
15
|
rvm:
|
8
|
-
- 2.
|
16
|
+
- 2.3
|
9
17
|
- 2.2
|
10
|
-
- 2.
|
11
|
-
-
|
12
|
-
-
|
18
|
+
- 2.1
|
19
|
+
- jruby-9.1.5.0
|
20
|
+
- ruby-head
|
21
|
+
- rbx-3
|
13
22
|
env:
|
14
23
|
global:
|
15
24
|
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
16
25
|
matrix:
|
17
26
|
allow_failures:
|
18
|
-
- rvm:
|
19
|
-
- rvm: rbx-
|
27
|
+
- rvm: ruby-head
|
28
|
+
- rvm: rbx-3
|
20
29
|
notifications:
|
21
30
|
email: false
|
22
31
|
webhooks:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# v0.4.1 2017-01-23
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
|
5
|
+
* Predicates simply reuse other predicate methods instead of referring to them via `#[]` (georgemillo)
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
* Warnings on MRI 2.4.0 are gone (jtippett)
|
10
|
+
|
11
|
+
[Compare v0.4.0...v0.4.1](https://github.com/dryrb/dry-logic/compare/v0.4.0...v0.4.1)
|
12
|
+
|
1
13
|
# v0.4.0 2016-09-21
|
2
14
|
|
3
15
|
This is a partial rewrite focused on internal clean up and major performance improvements. This is also the beginning of the work to make this library first-class rather than "just" a rule backend for dry-validation and dry-types.
|
data/Gemfile
CHANGED
@@ -4,11 +4,12 @@ gemspec
|
|
4
4
|
|
5
5
|
group :test do
|
6
6
|
gem 'codeclimate-test-reporter', platform: :mri
|
7
|
+
gem 'simplecov', require: false, platform: :mri
|
7
8
|
end
|
8
9
|
|
9
10
|
group :tools do
|
11
|
+
gem 'rubocop'
|
10
12
|
gem 'byebug', platform: :mri
|
11
|
-
gem 'simplecov', platforms: :mri
|
12
13
|
|
13
14
|
unless ENV['TRAVIS']
|
14
15
|
gem 'mutant', github: 'mbj/mutant'
|
data/dry-logic.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
|
18
|
-
spec.add_runtime_dependency 'dry-core', '~> 0.
|
18
|
+
spec.add_runtime_dependency 'dry-core', '~> 0.2'
|
19
19
|
spec.add_runtime_dependency 'dry-container', '~> 0.2', '>= 0.2.6'
|
20
20
|
spec.add_runtime_dependency 'dry-equalizer', '~> 0.2'
|
21
21
|
|
data/lib/dry/logic/predicates.rb
CHANGED
@@ -36,7 +36,7 @@ module Dry
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def filled?(input)
|
39
|
-
!
|
39
|
+
!empty?(input)
|
40
40
|
end
|
41
41
|
|
42
42
|
def bool?(input)
|
@@ -64,7 +64,7 @@ module Dry
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def int?(input)
|
67
|
-
input.is_a?(
|
67
|
+
input.is_a?(Integer)
|
68
68
|
end
|
69
69
|
|
70
70
|
def float?(input)
|
@@ -104,16 +104,16 @@ module Dry
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def lteq?(num, input)
|
107
|
-
!
|
107
|
+
!gt?(num, input)
|
108
108
|
end
|
109
109
|
|
110
110
|
def gteq?(num, input)
|
111
|
-
!
|
111
|
+
!lt?(num, input)
|
112
112
|
end
|
113
113
|
|
114
114
|
def size?(size, input)
|
115
115
|
case size
|
116
|
-
when
|
116
|
+
when Integer then size == input.size
|
117
117
|
when Range, Array then size.include?(input.size)
|
118
118
|
else
|
119
119
|
raise ArgumentError, "+#{size}+ is not supported type for size? predicate."
|
@@ -130,12 +130,12 @@ module Dry
|
|
130
130
|
|
131
131
|
def inclusion?(list, input)
|
132
132
|
::Kernel.warn 'inclusion is deprecated - use included_in instead.'
|
133
|
-
|
133
|
+
included_in?(list, input)
|
134
134
|
end
|
135
135
|
|
136
136
|
def exclusion?(list, input)
|
137
137
|
::Kernel.warn 'exclusion is deprecated - use excluded_from instead.'
|
138
|
-
|
138
|
+
excluded_from?(list, input)
|
139
139
|
end
|
140
140
|
|
141
141
|
def included_in?(list, input)
|
@@ -159,7 +159,7 @@ module Dry
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def excludes?(value, input)
|
162
|
-
!
|
162
|
+
!includes?(value, input)
|
163
163
|
end
|
164
164
|
|
165
165
|
def eql?(left, right)
|
data/lib/dry/logic/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
if RUBY_ENGINE == 'ruby' &&
|
2
|
-
require "codeclimate-test-reporter"
|
3
|
-
CodeClimate::TestReporter.start
|
4
|
-
end
|
5
|
-
|
6
|
-
if ENV['COVERAGE']
|
1
|
+
if RUBY_ENGINE == 'ruby' && ENV['CI'] == 'true'
|
7
2
|
require 'simplecov'
|
8
|
-
SimpleCov.start
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter 'spec/'
|
5
|
+
end
|
9
6
|
end
|
10
7
|
|
11
8
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.2'
|
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: '0.
|
26
|
+
version: '0.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dry-container
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,6 +107,7 @@ executables: []
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
+
- ".codeclimate.yml"
|
110
111
|
- ".gitignore"
|
111
112
|
- ".rspec"
|
112
113
|
- ".rubocop.yml"
|
@@ -218,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
219
|
version: '0'
|
219
220
|
requirements: []
|
220
221
|
rubyforge_project:
|
221
|
-
rubygems_version: 2.
|
222
|
+
rubygems_version: 2.6.9
|
222
223
|
signing_key:
|
223
224
|
specification_version: 4
|
224
225
|
summary: Predicate logic with rule composition
|