dentaku 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/dentaku/tokenizer.rb +2 -2
- data/lib/dentaku/version.rb +1 -1
- data/spec/calculator_spec.rb +2 -0
- metadata +23 -7
data/.gitignore
CHANGED
data/lib/dentaku/tokenizer.rb
CHANGED
@@ -37,8 +37,8 @@ module Dentaku
|
|
37
37
|
end
|
38
38
|
end),
|
39
39
|
TokenScanner.new(:combinator, '(and|or)\b', lambda {|raw| raw.strip.downcase.to_sym }),
|
40
|
-
TokenScanner.new(:function, '(if|round|not)\b', lambda {|raw| raw.strip.to_sym }),
|
41
|
-
TokenScanner.new(:identifier, '\w+\b', lambda {|raw| raw.downcase.to_sym })
|
40
|
+
TokenScanner.new(:function, '(if|round|not)\b', lambda {|raw| raw.strip.downcase.to_sym }),
|
41
|
+
TokenScanner.new(:identifier, '\w+\b', lambda {|raw| raw.strip.downcase.to_sym })
|
42
42
|
]
|
43
43
|
|
44
44
|
LPAREN = TokenMatcher.new(:grouping, :open)
|
data/lib/dentaku/version.rb
CHANGED
data/spec/calculator_spec.rb
CHANGED
@@ -78,6 +78,8 @@ describe Dentaku::Calculator do
|
|
78
78
|
calculator.evaluate('round(8.2)').should eq(8)
|
79
79
|
calculator.evaluate('round(8.8)').should eq(9)
|
80
80
|
calculator.evaluate('round(8.75, 1)').should eq(8.8)
|
81
|
+
|
82
|
+
calculator.evaluate('ROUND(apples * 0.93)', { :apples => 10 }).should eq(9)
|
81
83
|
end
|
82
84
|
end
|
83
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dentaku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
description: ! ' Dentaku is a parser and evaluator for mathematical formulas
|
37
47
|
|
38
48
|
'
|
@@ -75,15 +85,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
85
|
- - ! '>='
|
76
86
|
- !ruby/object:Gem::Version
|
77
87
|
version: '0'
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
hash: 4557179252548583095
|
78
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
92
|
none: false
|
80
93
|
requirements:
|
81
94
|
- - ! '>='
|
82
95
|
- !ruby/object:Gem::Version
|
83
96
|
version: '0'
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
hash: 4557179252548583095
|
84
100
|
requirements: []
|
85
101
|
rubyforge_project: dentaku
|
86
|
-
rubygems_version: 1.8.
|
102
|
+
rubygems_version: 1.8.23
|
87
103
|
signing_key:
|
88
104
|
specification_version: 3
|
89
105
|
summary: A formula language parser and evaluator
|