kalculator 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: 6220f71e922ae69d228c6a9b1e6da291585577338c048587c1b68a9a7a84808c
4
- data.tar.gz: 8eceb95b3f89519cf58f6ce72d391398a16dfd809015aea5f99c87b74b0a22a2
3
+ metadata.gz: c192de434bfd521b2abde4bcdd7e19b33aabf7315eec6b999687478aa8a2321b
4
+ data.tar.gz: a66810da20caf1fe4a2b682d987b081c58c71aeeb74dec0ac99e69aab1d0168d
5
5
  SHA512:
6
- metadata.gz: c5affaa47b3d2757ef89b602e38eb246d99aca5378d9f92a4f03d4d904442f170556e2df4327eeabd46bcf542b2ad6209fa11b26da691f79879c1f025e39882a
7
- data.tar.gz: 738b7ae968c9e4c3374d83d07c10e6142ef9ad5a8c9a965a2997f3c6f6cced157e5239952526f4879b62cdc658375eb5f485b40632a8a082a54c17a948d8dc76
6
+ metadata.gz: d5c9b29cf0b2f2bb327610407e499ece24abc585b4f3f543de7cf31593fe2ad8836fe0038f5c37750c59e2959e27418e5b710d211bc2d89d065074dcc2f10bed
7
+ data.tar.gz: c7aa10d0ea25bc227ea19e4c160bca130e1fdcd417de0318e722c8813eb8df630adad85fad3413537fd1f9e8243ad17591a5e625762148ba0ed49a9026269bbd
@@ -86,6 +86,10 @@ class Kalculator
86
86
  Date.parse(value)
87
87
  end
88
88
 
89
+ def exists(_, variable_name)
90
+ @data_source.key?(variable_name)
91
+ end
92
+
89
93
  def if(_, condition, true_clause, false_clause)
90
94
  if evaluate(condition)
91
95
  evaluate(true_clause)
@@ -25,6 +25,7 @@ class Kalculator
25
25
  rule(/contains/) { |t| :CONTAINS }
26
26
  rule(/count/) { |t| :COUNT }
27
27
  rule(/date/) { |t| :DATE }
28
+ rule(/exists/) { |t| :EXISTS }
28
29
  rule(/if/) { |t| :IF }
29
30
  rule(/max/) { |t| :MAX }
30
31
  rule(/min/) { |t| :MIN }
@@ -22,6 +22,9 @@ class Kalculator
22
22
  clause('DATE LPAREN expression RPAREN') do |_, _, e0, _|
23
23
  [:date, e0]
24
24
  end
25
+ clause('EXISTS LPAREN IDENT RPAREN') do |_, _, n, _|
26
+ [:exists, n]
27
+ end
25
28
  clause('MAX LPAREN expression COMMA expression RPAREN') { |_, _, left, _, right, _| [:max, left, right] }
26
29
  clause('MIN LPAREN expression COMMA expression RPAREN') { |_, _, left, _, right, _| [:min, left, right] }
27
30
  clause('LPAREN expression RPAREN') { |_, expression, _| expression }
@@ -1,3 +1,3 @@
1
1
  class Kalculator
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalculator
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
  - Michael Ries
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-16 00:00:00.000000000 Z
11
+ date: 2018-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rltk