dry-logic 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/dry/logic/rule/interface.rb +18 -0
- data/lib/dry/logic/version.rb +1 -1
- data/spec/unit/rule_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e8baed5b3ce1bb97123c2c5f38a487053bd8bec09e9224d41ef2efb9ecb7bd9
|
4
|
+
data.tar.gz: f42f53680f4afa74af7d8fcf2f647e22789e49b2730669802741ffa51f01bd8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 962f58beea21b1d07cdff41057f0d7592504736baa63166fbf291bd08423eac2d128423e62a7799e15b224ad1566784a821084d81b9fb14887f29243e40bab6c
|
7
|
+
data.tar.gz: c7a1978b847dc59b8fbbcfe680639bf108ae562134ab727f3bc6843dce17db8e19d7b9c7e298cb6ed09f1a8bfc7da57a02c1e7d3b49d545df9bc09192ddc7f9e
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[chat]: https://dry-rb.zulipchat.com
|
5
5
|
[inchpages]: http://inch-ci.org/github/dry-rb/dry-logic
|
6
6
|
|
7
|
-
# dry-
|
7
|
+
# dry-logic [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
|
8
8
|
|
9
9
|
[![Gem Version](https://badge.fury.io/rb/dry-logic.svg)][gem]
|
10
10
|
[![Build Status](https://travis-ci.org/dry-rb/dry-logic.svg?branch=master)][travis]
|
@@ -18,6 +18,8 @@ module Dry
|
|
18
18
|
|
19
19
|
if variable_arity?
|
20
20
|
define_splat_application
|
21
|
+
elsif constant?
|
22
|
+
define_constant_application
|
21
23
|
else
|
22
24
|
define_fixed_application
|
23
25
|
end
|
@@ -71,6 +73,22 @@ module Dry
|
|
71
73
|
RUBY
|
72
74
|
end
|
73
75
|
|
76
|
+
def define_constant_application
|
77
|
+
module_exec do
|
78
|
+
def call(*)
|
79
|
+
if @predicate[]
|
80
|
+
Result::SUCCESS
|
81
|
+
else
|
82
|
+
Result.new(false, id) { ast }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def [](*)
|
87
|
+
@predicate[]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
74
92
|
def define_splat_application
|
75
93
|
application =
|
76
94
|
if curried?
|
data/lib/dry/logic/version.rb
CHANGED
data/spec/unit/rule_spec.rb
CHANGED
@@ -198,5 +198,14 @@ RSpec.describe Dry::Logic::Rule do
|
|
198
198
|
expect(rule.method(:[]).arity).to be(-1)
|
199
199
|
end
|
200
200
|
end
|
201
|
+
|
202
|
+
describe 'constants' do
|
203
|
+
let(:options) { { args: [], arity: 0 } }
|
204
|
+
|
205
|
+
fit 'accepts variable number of arguments' do
|
206
|
+
expect(rule.method(:call).arity).to be(-1)
|
207
|
+
expect(rule.method(:[]).arity).to be(-1)
|
208
|
+
end
|
209
|
+
end
|
201
210
|
end
|
202
211
|
end
|
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.6.
|
4
|
+
version: 0.6.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: 2019-04-
|
11
|
+
date: 2019-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|