excel_to_code 0.2.13 → 0.2.14
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5462c5420b1ec9bd0cb8fc6c2a6641475348f7b1
|
4
|
+
data.tar.gz: e5bd8eb39e00007be6ac7b847d7b3fabd3260dcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49e9dde17bb074100d96a2868a79f95bf1ec111dfe0bf6675759a272407980cd830110a7eda9db3c5257d2bb2ead0d889798b564fe0a82fcddc87d757298d6e3
|
7
|
+
data.tar.gz: 2e4da6cd7577fc93718190048457e08fcd0067a66d69ac45fdfff46b99622b58c20ae22591d0e76d99e40670cd8f2ded881f7dc6b544fcd447abb9e61c64357e
|
data/src/excel_to_code.rb
CHANGED
@@ -5,8 +5,11 @@ class AstExpandArrayFormulae
|
|
5
5
|
def map(ast)
|
6
6
|
return ast unless ast.is_a?(Array)
|
7
7
|
operator = ast[0]
|
8
|
-
|
9
|
-
|
8
|
+
if respond_to?(operator)
|
9
|
+
send(operator, ast)
|
10
|
+
else
|
11
|
+
ast.each {|a| map(a) }
|
12
|
+
end
|
10
13
|
ast
|
11
14
|
end
|
12
15
|
|
@@ -22,9 +22,16 @@ class InlineFormulaeAst
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def function(ast)
|
25
|
-
|
25
|
+
case ast[1]
|
26
|
+
when :OFFSET
|
26
27
|
# Don't map the second argument - it should be left as a cell refernce
|
27
|
-
ast[
|
28
|
+
if (ast[2][0] == :cell || ast[2][0] == :sheet_reference)
|
29
|
+
ast[3..-1].each {|a| map(a) }
|
30
|
+
else
|
31
|
+
ast.each { |a| map(a) }
|
32
|
+
end
|
33
|
+
when :COLUMN, :ROW
|
34
|
+
# Don't map any arguments
|
28
35
|
else
|
29
36
|
# Otherwise good to map all the other arguments
|
30
37
|
ast.each { |a| map(a) }
|
@@ -16,8 +16,8 @@ class ReplaceColumnAndRowFunctionsAST
|
|
16
16
|
|
17
17
|
def map(ast)
|
18
18
|
return ast unless ast.is_a?(Array)
|
19
|
-
function(ast) if ast[0] == :function
|
20
19
|
ast.each { |a| map(a) }
|
20
|
+
function(ast) if ast[0] == :function
|
21
21
|
ast
|
22
22
|
end
|
23
23
|
|
@@ -31,7 +31,7 @@ class ReplaceColumnAndRowFunctionsAST
|
|
31
31
|
elsif ast[2][0] == :sheet_reference
|
32
32
|
reference = Reference.for(ast[2][2][1])
|
33
33
|
else
|
34
|
-
|
34
|
+
raise ExcelToCodeException.new("COLUMN/ROW not replaced in #{@current_reference} #{ast}")
|
35
35
|
end
|
36
36
|
else
|
37
37
|
reference = Reference.for(@current_reference)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excel_to_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Counsell, Green on Black Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubypeg
|