expressive 0.0.34 → 0.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/expressive.rb +1 -1
- data/lib/expressive/version.rb +1 -1
- data/lib/scope.rb +1 -0
- data/spec/expressive_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yzg1YTRmMzc4ZWE0Y2YzNmFiODRjNGViZGZlYTk0ZDA0YWE3ODE2Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTcyM2M0NjRiMjJjODBhZTcyYjNiZjQwYzdhNjNmNWEyMmEzZDZlZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWFkMmNlZjRjM2QyYWJlOWUxNGQyNGY1YTZkZmRhZTdlZGFlZTcxZmE2ODU4
|
10
|
+
M2VkNjk2NTkyZDJhZDlmNDg1NjcyZTIwM2IyYTM0MWYwYmY1Mjk3NTYxZjY5
|
11
|
+
NWJiMTQ3NWNkNjQwM2YxNmQyYWFmMDI0OGY0MzM3NmE0ZmI2YWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjlkMGZhNDkxYzc2ODVlMGRiNTViMjFlZjM1MjQzMWUyOTIyNDBlN2I2YWQy
|
14
|
+
YzgxNGMxNTNlN2YwYTdhZWZmMTZiZmM5NWE4ZjE2ZGExZDljMzBlYmNlYjVj
|
15
|
+
NTY1ZjAzYzM5ZmFmMzBkNDUxMWI3ZDNiMjZlZmE3M2NiMDBmZGU=
|
data/lib/expressive.rb
CHANGED
@@ -35,7 +35,7 @@ module Expressive
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.all_symbols
|
38
|
-
%w(+ - * / = set sum $sub post >= > < <= and or if date datetime get put lookup $lookup $head $tail $reverse round $round $days_ago $hours_ago $minutes_ago $append $id $hash $concat $split $sms $hval $index $random $join $not)
|
38
|
+
%w(+ - * / = set sum $sub post >= > < <= and or if date datetime get put lookup $lookup $head $tail $reverse round $round $days_ago $hours_ago $minutes_ago $append $id $hash $concat $split $sms $hval $index $random $join $not $include)
|
39
39
|
end
|
40
40
|
|
41
41
|
module Boolean
|
data/lib/expressive/version.rb
CHANGED
data/lib/scope.rb
CHANGED
@@ -187,6 +187,7 @@ module Expressive
|
|
187
187
|
define('$hours_ago'){|*args| Time.now - args[0].to_i * 3600 }
|
188
188
|
define('$minutes_ago'){|*args| Time.now - args[0].to_i * 60 }
|
189
189
|
define('$head'){|*args| args.flatten.first }
|
190
|
+
define('$include'){|val, arr| arr.include?(val) }
|
190
191
|
define('$tail'){|*args| args.flatten[1..-1] }
|
191
192
|
define('$reverse'){|*args| args.flatten.reverse }
|
192
193
|
define('$not'){|*args| not args.first }
|
data/spec/expressive_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe "Expressive" do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "all_symbols" do
|
9
|
-
it { Expressive.all_symbols.should =~ %w(+ - * / = set sum $sub get put post >= > < <= and or if date datetime lookup round $round $days_ago $hours_ago $minutes_ago $append $id $head $lookup $reverse $tail $hash $concat $split $sms $hval $index $random $join $not) }
|
9
|
+
it { Expressive.all_symbols.should =~ %w(+ - * / = set sum $sub get put post >= > < <= and or if date datetime lookup round $round $days_ago $hours_ago $minutes_ago $append $id $head $lookup $reverse $tail $hash $concat $split $sms $hval $index $random $join $not $include) }
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "understands booleans" do
|
@@ -84,6 +84,10 @@ describe "Expressive" do
|
|
84
84
|
|
85
85
|
describe "understands list operations" do
|
86
86
|
it { Expressive.run("($head (1 2 3))").should eql 1 }
|
87
|
+
it { Expressive.run("($include 3 (1 2 3))").should eql true }
|
88
|
+
it { Expressive.run("($include 4 (1 2 3))").should eql false }
|
89
|
+
it { Expressive.run("($include ADAM001 (ADAM001 AIBO001 AMBR001 BARC002 BARC003))").should eql true}
|
90
|
+
it { Expressive.run("($include BDAM001 (ADAM001 AIBO001 AMBR001 BARC002 BARC003))").should eql true}
|
87
91
|
it { Expressive.run("($tail (1 2 3))").should eql [2, 3] }
|
88
92
|
it { Expressive.run("($reverse (1 2 3))").should eql [3 ,2 ,1] }
|
89
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expressive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ijonas Kisselbach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_gntp
|