csl 1.0.0.pre22 → 1.0.0.pre23

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: d4cb72ec6f5e2c4a369fe2fb0a5a36df75da5df9
4
- data.tar.gz: 4910056174f713025c28fd9a8136468fd785651a
3
+ metadata.gz: 23b9a4f1447a95e1b46a96a403ff301b1ab93f32
4
+ data.tar.gz: 0355a94ad1f0be978d1a8e243c99aa6ad4d9ee5e
5
5
  SHA512:
6
- metadata.gz: 74f0b979d50b5348d4f6a2b1e33c373e53abee501f840e9926f949ad2f4fb77c9a9bb07dbd302caffdfa2dc3b729cf06ddf1fb67ca4f7eebfc9efa998cdc3d34
7
- data.tar.gz: 6330e92fe3e39b5a4cb8b6fd365f2cfb5a95d425a8b74f046a02a83bd4580c4b9a9932e400c9e8491cc85e5a422ebcf542665a65c3b99e94b436615e2148bbde
6
+ metadata.gz: 41f1534aea931e42092073d7408b3105805f30a4e7656b53b63504e80b3eae1d4d5c0e08a704c7e3181b49a8482e0303a176a9561a4c097f196e7f14ce40e306
7
+ data.tar.gz: 0fd8a4e0eada2d438c213ff18495dfa6f8e153f2a079217f87e9d971c1fc31d4d30853999404396b7556800f92182e7f9e48b146404020390d0003f5086cbf3a
@@ -13,16 +13,14 @@ module CSL
13
13
  nodename.to_s =~ /^if(-else)?|else$/
14
14
  end
15
15
  end
16
-
16
+
17
17
  def conditions
18
18
  attributes_for(*Schema.attr(:conditionals)).map do |name, values|
19
19
  extract_type_and_matcher_from(name) << values.to_s.split(/\s+/)
20
20
  end
21
21
  end
22
22
 
23
- def matcher(match = nil)
24
- match ||= attributes[:match]
25
-
23
+ def matcher(match = attributes[:match])
26
24
  case match
27
25
  when 'any'
28
26
  :any?
@@ -32,12 +30,22 @@ module CSL
32
30
  :all?
33
31
  end
34
32
  end
35
-
33
+
36
34
  private
37
35
 
38
36
  def extract_type_and_matcher_from(attribute)
39
37
  type, match = attribute.to_s.split(/-(any|all|none)$/, 2)
40
- [type.to_sym, matcher(match)]
38
+
39
+ # subtle: if the default matcher is :none? and there
40
+ # is no override we to use :any? in the nested lists
41
+ # to avoid double negation during evaluation
42
+
43
+ if match.nil?
44
+ match = matcher
45
+ [type.to_sym, match == :none? ? :any? : matcher]
46
+ else
47
+ [type.to_sym, matcher(match)]
48
+ end
41
49
  end
42
50
  end
43
51
  end
data/lib/csl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CSL
2
- VERSION = '1.0.0.pre22'.freeze
2
+ VERSION = '1.0.0.pre23'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre22
4
+ version: 1.0.0.pre23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil