predicate 2.3.2 → 2.3.3

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: '039636282e90c0f484d6747ca27286890152c280dc9a5c7ba1d3fd21aff575f2'
4
- data.tar.gz: 1ccfa7508aee58a1734ecdb8ae1f4bee5c3c1718d284b04051877bb7dc5d94e2
3
+ metadata.gz: 6adb8570080165285172882eb0c0f8216180efa05a58df348055f9a406fcef24
4
+ data.tar.gz: 3add1e5ed2a4d728fb92637c8527b8dfeaa2b66f16622a45608aca1d9f079774
5
5
  SHA512:
6
- metadata.gz: 6470c50519c4675a6caebebf58767d2ff85b0c43e82ea838a0b042a84400c906a00aa84ec8707c3dfcdb548a8622bc31a333da55d4c8260817eef4d1629dd594
7
- data.tar.gz: d12feeb814e4e6d5eae9e8fbd5eab71af196bc113ab714e8b2b98583221d79f94b95bb860b681b50999eb1a68b3002c944183a31819860c4d5b7f0f29f4829ba
6
+ metadata.gz: 8967a78cd1bbee2b0e2666f0fe853743d98c5be4730c3d263ce30d541387b71de37ac1d3e9544d487c92782795fcdeeb116099b741a362b60390b35aa2834e6a
7
+ data.tar.gz: ed564310b25c229a65824e06d6b37353d326a1dd56b00a6723ad669c4321fa2d4e50d660d5c02b66efbaef695a2063504602e9466c7908b0ebf681943dc28571
@@ -88,6 +88,10 @@ class Predicate
88
88
  Predicate.new(expr.qualify(qualifier))
89
89
  end
90
90
 
91
+ def unqualify
92
+ Predicate.new(expr.unqualify)
93
+ end
94
+
91
95
  def rename(renaming)
92
96
  Predicate.new(expr.rename(renaming))
93
97
  end
@@ -77,6 +77,10 @@ class Predicate
77
77
  Qualifier.new(qualifier).call(self)
78
78
  end
79
79
 
80
+ def unqualify
81
+ Unqualifier.new.call(self)
82
+ end
83
+
80
84
  def bind(binding)
81
85
  Binder.new(binding).call(self)
82
86
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "processors/to_s"
2
2
  require_relative "processors/renamer"
3
3
  require_relative "processors/qualifier"
4
+ require_relative "processors/unqualifier"
4
5
  require_relative "processors/binder"
@@ -0,0 +1,17 @@
1
+ class Predicate
2
+ class Unqualifier < Sexpr::Rewriter
3
+
4
+ grammar Grammar
5
+
6
+ def on_qualified_identifier(sexpr)
7
+ [ :identifier, sexpr.last ]
8
+ end
9
+
10
+ def on_native(sexpr)
11
+ raise NotSupportedError
12
+ end
13
+
14
+ alias :on_missing :copy_and_apply
15
+
16
+ end
17
+ end
@@ -2,7 +2,7 @@ class Predicate
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 3
5
- TINY = 2
5
+ TINY = 3
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+ class Predicate
3
+ describe Predicate, "unqualify" do
4
+
5
+ let(:p){ Predicate }
6
+
7
+ subject{ predicate.unqualify }
8
+
9
+ context 'when the predicate is not qualified' do
10
+ let(:predicate){ p.in(:x, [2]) & p.eq(:y, :z) }
11
+
12
+ it 'works as expected' do
13
+ expect(subject).to eql(predicate)
14
+ end
15
+ end
16
+
17
+ end
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: predicate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
@@ -122,6 +122,7 @@ files:
122
122
  - lib/predicate/processors/qualifier.rb
123
123
  - lib/predicate/processors/renamer.rb
124
124
  - lib/predicate/processors/to_s.rb
125
+ - lib/predicate/processors/unqualifier.rb
125
126
  - lib/predicate/sequel.rb
126
127
  - lib/predicate/sequel/to_sequel.rb
127
128
  - lib/predicate/version.rb
@@ -182,6 +183,7 @@ files:
182
183
  - spec/predicate/test_qualify.rb
183
184
  - spec/predicate/test_rename.rb
184
185
  - spec/predicate/test_tautology.rb
186
+ - spec/predicate/test_unqualify.rb
185
187
  - spec/sequel/test_to_sequel.rb
186
188
  - spec/spec_helper.rb
187
189
  - spec/test_predicate.rb