expressive 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- expressive (0.0.10)
4
+ expressive (0.0.11)
5
5
  awesome_print (~> 1.0.2)
6
6
  json
7
7
  polyglot (~> 0.3.3)
@@ -1,3 +1,3 @@
1
1
  module Expressive
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -121,7 +121,7 @@ module Expressive
121
121
  define('<=') {|a,b| a.to_f <= b.to_f }
122
122
  define('and') {|a,b| !!a && !!b }
123
123
  define('or') {|a,b| !!a || !!b }
124
- define('sum') { |*args| args.flatten.map(&:to_f).reduce(:+) }
124
+ define('sum') { |*args| args.flatten.map(&:to_f).reduce(:+) || 0 }
125
125
  define('if') { |*args| args.compact!; args[0] ? args[1] : args[2] }
126
126
  end
127
127
 
@@ -37,6 +37,8 @@ describe "Expressive" do
37
37
  it { Expressive.run("(* 4 2)").should eql 8.0 }
38
38
  it { Expressive.run("(/ 4 2)").should eql 2.0 }
39
39
  it { Expressive.run("(sum 1 2 3)").should eql 6.0 }
40
+ it { Expressive.run("(sum )").should eql 0 }
41
+ it { Expressive.run("(- (sum 1 5 7) 3)").should eql 10.0}
40
42
  end
41
43
 
42
44
  describe "understands comparisson" do
@@ -130,7 +132,7 @@ describe "Expressive" do
130
132
  end
131
133
  it "will set multiple values based on results of a lookup" do
132
134
  @owned_by_ext_value = Expressive::ExtendedValue.new(:x_owned_by, @scope)
133
- @owned_by_ext_value.setter = Proc.new do |value, scope|
135
+ @owned_by_ext_value.setter = Proc.new do |value, scope|
134
136
  scope["owned_by_id"] = value.id
135
137
  scope["owned_by_type"] = value.class.to_s
136
138
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expressive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_gntp
@@ -294,7 +294,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
294
  version: '0'
295
295
  segments:
296
296
  - 0
297
- hash: -3548167476623958154
297
+ hash: -3943377900405083891
298
298
  required_rubygems_version: !ruby/object:Gem::Requirement
299
299
  none: false
300
300
  requirements:
@@ -303,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  version: '0'
304
304
  segments:
305
305
  - 0
306
- hash: -3548167476623958154
306
+ hash: -3943377900405083891
307
307
  requirements: []
308
308
  rubyforge_project:
309
309
  rubygems_version: 1.8.24