expressive 0.0.36 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTZiZTNjOTMzNmUwOTA5ODg1NmE0MGViMmIxZTA4YWQ1NTQyOTE0Mw==
4
+ NTU5NTY4ODE1ZjQ1NzQyZDBlNmYyZGE5YmY2MjIwZmU3MGEyOWI0Mw==
5
5
  data.tar.gz: !binary |-
6
- MDVhNDA4NzJhNzBhODM1NDg2NzU2ZjYyODkxYjQxMTc3YzlhODMxYw==
6
+ NmJlN2UyOTFlMTk4ZDUwMzgzZjJlNWY3M2ExYzdkMWQ4ODViNDc0Nw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZWY0NTM0NmNhZGYyNzRlMDQ2M2FmZTAzOWNhMWI0YTljZTY4YjYzNTQwNWFj
10
- MmE2ZjgyNTI1OTc3NzA1OGRlYjA1ODI2NWQyYThiNDc1OTQzZDMzNmMzZjlj
11
- MTQxMzlkMTdkOTcyM2ZiZWUxY2IxZmY4ZjkyNGE5ZGZjMjdmMGE=
9
+ MzY0NTk0Yzg0ZDlkZDU5NGFjYzk4ZDExODAwZDc1MTZmZDE2YjMyOTQxMzk1
10
+ MTZlNGY4NDcyZDY5ZjU0ZTU2NGNlM2MxY2Q2ZGI5ZjQxZGNkOWNlNGJiMmQ5
11
+ YTZhMjBjNzRiZDcxNDE2Nzk5NjYzMDE2YTU0ZWFiYWE3NWJjMDI=
12
12
  data.tar.gz: !binary |-
13
- ZjVmZTE5YTRkMjljY2ZlYzBlN2QzZDYzYmFhZjQ4NmM5ZDliZWE2NTA1ZTk0
14
- ZmVmMmExNGVmMDFkNjYxMGJmOGFkYTA4MzNhOGMyZjlmMTZkNWE0YmFmMmFm
15
- ZDZmY2ExMDI3ODQzNWJlZDEwNDgzNzEyMjU5YzcyZWVmMGQ3NjA=
13
+ NDcyNjk4ZjQxMmExNGJhODA2ZmY0MjcwMzkwOTQ0NDY3YThjODg4YTU5MWZk
14
+ YjY5MThlNjEwZDA3NjQwNjBmYjM5ZjE4YmU5MmUzZDk5NWZhMDdlOTgzNWQy
15
+ ZDRiNDM2MDM0YzhhNjVlMzU0NjI3MDQwYWRjMDMwN2E5NmE4ZjM=
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ expressive
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- expressive (0.0.36)
4
+ expressive (0.0.37)
5
5
  awesome_print (~> 1.0.2)
6
6
  json
7
7
  polyglot (~> 0.3.3)
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 $include $string $float $integer)
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 $string $float $integer)
39
39
  end
40
40
 
41
41
  module Boolean
@@ -1,3 +1,3 @@
1
1
  module Expressive
2
- VERSION = "0.0.36"
2
+ VERSION = "0.0.37"
3
3
  end
data/lib/scope.rb CHANGED
@@ -174,6 +174,7 @@ module Expressive
174
174
  define('*') {|a,b| a.to_f * b.to_f }
175
175
  define('/') {|a,b| a.to_f / b.to_f }
176
176
  define('=') {|a,b| a == b }
177
+ define('~') {|a,b| !!(a =~ Regexp.new(b)) }
177
178
  define('>') {|a,b| a.to_f > b.to_f }
178
179
  define('<') {|a,b| a.to_f < b.to_f }
179
180
  define('>=') {|a,b| a.to_f >= b.to_f }
@@ -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 $include $string $float $integer) }
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 $string $float $integer) }
10
10
  end
11
11
 
12
12
  describe "understands booleans" do
@@ -95,6 +95,13 @@ describe "Expressive" do
95
95
  it { Expressive.run("(<= 4 4)").should eql true }
96
96
  end
97
97
 
98
+ describe "understands regex" do
99
+ it { Expressive.run('(~ "asdf" "as.f")').should eql true}
100
+ it { Expressive.run('(~ "asdf" "asdf.")').should eql false}
101
+ it { Expressive.run('(~ "asdf" "^asdf$")').should eql true}
102
+ it { Expressive.run('(~ "asdf" "$sdf")').should eql false}
103
+ end
104
+
98
105
  describe "understands list operations" do
99
106
  it { Expressive.run("($head (1 2 3))").should eql 1 }
100
107
  it { Expressive.run("($include 3 (1 2 3))").should eql true }
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.36
4
+ version: 0.0.37
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-08-05 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_gntp
@@ -230,6 +230,8 @@ files:
230
230
  - .document
231
231
  - .gitignore
232
232
  - .rspec
233
+ - .ruby-gemset
234
+ - .ruby-version
233
235
  - Gemfile
234
236
  - Gemfile.lock
235
237
  - Guardfile