bmg 0.20.2 → 0.21.0

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: 45a80b1a3fd00fc27f88f37b41816dd11324aa70
4
- data.tar.gz: 9d600dd0619e0d814a07db94c95dc093b61584b9
3
+ metadata.gz: ef6b320621feeff681bb76b804da274ae055573c
4
+ data.tar.gz: 2a119b1aa5838fbb2b657332de25fd22cc10dbb6
5
5
  SHA512:
6
- metadata.gz: 38fefe80ca45ddce14d3310621b82b389db5a7c11ab22bb17563c2c6f7dc769f9a54f9a3bebde6c40a2bbecbae215969857a8cf875a7363ad10261fd5b32b75f
7
- data.tar.gz: 91492014f31ff3c540df388cac9e362e16555e373ca59ed178bdf32f7098d176947f7e6432df804a8bb3f34210d8a3762b92ce39d37455ff2ee2e55346bf9bce
6
+ metadata.gz: e33cda560cb1c3f119940745c63f45884a406d7b0bce113d08a43d2f374a9a658ab47667c63919d16d5863f6867f2d29808d23a049efe9e34487a282e29c9c82
7
+ data.tar.gz: ec437125ffbf4e41633b33c6ddc5eedeccef915dd2201f7d0f2a54e8ba348f272e67195ebc57cd8a8e839b07a0fa1aacb957eacf6723d34a42b03dac1d4783ec
@@ -68,6 +68,20 @@ module Bmg
68
68
 
69
69
  protected ### optimization
70
70
 
71
+ def _allbut(type, butlist)
72
+ new_roots = wrapped_roots!
73
+ separator = @options[:split]
74
+ down = operand.type.attrlist!.select { |attr|
75
+ root = attr.to_s.split(separator).map(&:to_sym).first
76
+ butlist.include?(root)
77
+ }
78
+ r = operand.allbut(down)
79
+ r = r.autowrap(options) unless (butlist & new_roots == new_roots)
80
+ r
81
+ rescue UnknownAttributesError
82
+ super
83
+ end
84
+
71
85
  def _autowrap(type, opts)
72
86
  if same_options?(opts)
73
87
  self
@@ -122,11 +136,12 @@ module Bmg
122
136
  end
123
137
 
124
138
  def _project(type, attrlist)
125
- if (wrapped_roots! & attrlist).empty?
126
- operand.project(attrlist).autowrap(options)
127
- else
128
- super
129
- end
139
+ separator = @options[:split]
140
+ to_keep = operand.type.attrlist!.select { |attr|
141
+ root = attr.to_s.split(separator).map(&:to_sym).first
142
+ attrlist.include?(root)
143
+ }
144
+ operand.project(to_keep).autowrap(options)
130
145
  rescue UnknownAttributesError
131
146
  super
132
147
  end
@@ -169,6 +184,7 @@ module Bmg
169
184
 
170
185
  def wrapped_roots_of!(r, opts)
171
186
  raise UnknownAttributesError unless r.type.knows_attrlist?
187
+
172
188
  Support.wrapped_roots(r.type.to_attrlist, opts[:split])
173
189
  end
174
190
 
@@ -67,6 +67,10 @@ module Bmg
67
67
  operand.restrict(predicate).project(attrlist)
68
68
  end
69
69
 
70
+ def _allbut(type, butlist)
71
+ Project.new(type, @operand, attrlist - butlist)
72
+ end
73
+
70
74
  protected ### inspect
71
75
 
72
76
  def args
data/lib/bmg/type.rb CHANGED
@@ -46,6 +46,11 @@ module Bmg
46
46
  attr_accessor :attrlist
47
47
  protected :attrlist=
48
48
 
49
+ def attrlist!
50
+ knows_attrlist!
51
+ attrlist
52
+ end
53
+
49
54
  def with_attrlist(attrlist)
50
55
  dup.tap{|x|
51
56
  x.attrlist = attrlist
data/lib/bmg/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Bmg
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 20
5
- TINY = 2
4
+ MINOR = 21
5
+ TINY = 0
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.2
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-01 00:00:00.000000000 Z
11
+ date: 2023-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: predicate