expressive 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/expressive/version.rb +1 -1
- data/lib/scope.rb +1 -0
- data/spec/expressive_spec.rb +1 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/expressive/version.rb
CHANGED
data/lib/scope.rb
CHANGED
@@ -123,6 +123,7 @@ module Expressive
|
|
123
123
|
define('or') {|a,b| !!a || !!b }
|
124
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
|
+
define('round'){|*args| args[0].to_f.round(args[1]) }
|
126
127
|
end
|
127
128
|
|
128
129
|
def to_hash
|
data/spec/expressive_spec.rb
CHANGED
@@ -39,6 +39,7 @@ describe "Expressive" do
|
|
39
39
|
it { Expressive.run("(sum 1 2 3)").should eql 6.0 }
|
40
40
|
it { Expressive.run("(sum )").should eql 0 }
|
41
41
|
it { Expressive.run("(- (sum 1 5 7) 3)").should eql 10.0}
|
42
|
+
it { Expressive.run("(round 0.12345 2)").should eql 0.12}
|
42
43
|
end
|
43
44
|
|
44
45
|
describe "understands comparisson" do
|
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.
|
4
|
+
version: 0.0.12
|
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-03-
|
12
|
+
date: 2013-03-14 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:
|
297
|
+
hash: 1047830974814440545
|
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:
|
306
|
+
hash: 1047830974814440545
|
307
307
|
requirements: []
|
308
308
|
rubyforge_project:
|
309
309
|
rubygems_version: 1.8.24
|