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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12cf783095366932df786fea023d69be64d48e7b91c03a279186d9be7ed098b4
4
- data.tar.gz: e324cfb405828951649cd948055dc4fbfb84eb65f50156cee29695785d8b065f
3
+ metadata.gz: 1e8baed5b3ce1bb97123c2c5f38a487053bd8bec09e9224d41ef2efb9ecb7bd9
4
+ data.tar.gz: f42f53680f4afa74af7d8fcf2f647e22789e49b2730669802741ffa51f01bd8a
5
5
  SHA512:
6
- metadata.gz: 476e8b141e0868cc3bdcdee4c7d695809ae056d6b7977b0b49db6af47990a1a285b33350ef6a789670576d64bcb8495b0068228a812d6a7727b98250445c1485
7
- data.tar.gz: c3de162dc7c3f75b7ee0c2e321406cc9e9f5f17d0e73c7ef416bb40981b037ce3c4c846a9f55cb5a3602ae3deb2a4162e3a502c20f87cd1009b97f4c8ecdc690
6
+ metadata.gz: 962f58beea21b1d07cdff41057f0d7592504736baa63166fbf291bd08423eac2d128423e62a7799e15b224ad1566784a821084d81b9fb14887f29243e40bab6c
7
+ data.tar.gz: c7a1978b847dc59b8fbbcfe680639bf108ae562134ab727f3bc6843dce17db8e19d7b9c7e298cb6ed09f1a8bfc7da57a02c1e7d3b49d545df9bc09192ddc7f9e
@@ -13,7 +13,7 @@ rvm:
13
13
  - 2.6.2
14
14
  - 2.5.5
15
15
  - 2.4.6
16
- - jruby-9.2.6.0
16
+ - jruby-9.2.7.0
17
17
  - truffleruby
18
18
  env:
19
19
  global:
@@ -1,3 +1,9 @@
1
+ # v0.6.1 2019-04-18
2
+
3
+ * Fix a regression in dry-validation 0.x for argument-less predicates (flash-gordon)
4
+
5
+ [Compare v0.6.0...v0.6.1](https://github.com/dry-rb/dry-logic/compare/v0.6.0...v0.6.1)
6
+
1
7
  # v0.6.0 2019-04-04
2
8
 
3
9
  ### Added
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-schema [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
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?
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Logic
3
- VERSION = '0.6.0'.freeze
3
+ VERSION = '0.6.1'.freeze
4
4
  end
5
5
  end
@@ -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.0
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-04 00:00:00.000000000 Z
11
+ date: 2019-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby