excel_to_code 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/commands/excel_to_x.rb +34 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30a048682c2cf9317de28a612f4394e205d507fb
|
4
|
+
data.tar.gz: 95d2d238aab30a09195a6665f91124e2fa6a4c29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 087a77eefc3bcbfc39b330c2bf21c7ca58e9a5dfd529db6e345ec820937a6e1d16a0ccee457f67a2f8fe001a95ba8f3f2dd29a017e462d05f6fb281f37811619
|
7
|
+
data.tar.gz: 4bdda7d4a4db5e06468b16c9ed3f4e544c60757f33bcf705039677174603c8a522d462bb5011d0a470da20d4283a5fff3e018eaa04235c73f6a1b078cd86521a
|
data/src/commands/excel_to_x.rb
CHANGED
@@ -509,6 +509,8 @@ class ExcelToX
|
|
509
509
|
def required_references
|
510
510
|
log.info "Checking required references"
|
511
511
|
required_refs = {}
|
512
|
+
|
513
|
+
# Need to add blank for any settable cells that aren't defined
|
512
514
|
if @cells_that_can_be_set_at_runtime && @cells_that_can_be_set_at_runtime != :named_references_only
|
513
515
|
@cells_that_can_be_set_at_runtime.each do |worksheet, refs|
|
514
516
|
next if refs == :all
|
@@ -517,6 +519,8 @@ class ExcelToX
|
|
517
519
|
end
|
518
520
|
end
|
519
521
|
end
|
522
|
+
|
523
|
+
# Need to add blanks for any cells the user want's, but aren't defined
|
520
524
|
if @cells_to_keep
|
521
525
|
@cells_to_keep.each do |worksheet, refs|
|
522
526
|
next if refs == :all
|
@@ -525,6 +529,34 @@ class ExcelToX
|
|
525
529
|
end
|
526
530
|
end
|
527
531
|
end
|
532
|
+
|
533
|
+
# In some situations also need to add the named references
|
534
|
+
if @named_references_to_keep
|
535
|
+
@named_references_to_keep.each do |name|
|
536
|
+
ref = @named_references[name]
|
537
|
+
if ref.first == :sheet_reference
|
538
|
+
s = ref[1]
|
539
|
+
c = Reference.for(ref[2][1]).unfix.to_sym
|
540
|
+
required_refs[[s, c]] = [:blank]
|
541
|
+
elsif ref.first == :array
|
542
|
+
ref.each do |row|
|
543
|
+
next unless row.is_a?(Array)
|
544
|
+
row.each do |cell|
|
545
|
+
next unless cell.is_a?(Array)
|
546
|
+
if cell.first == :sheet_reference
|
547
|
+
s = cell[1]
|
548
|
+
c = Reference.for(cell[2][1]).unfix.to_sym
|
549
|
+
required_refs[[s, c]] = [:blank]
|
550
|
+
else
|
551
|
+
log.warn "Named reference '#{name}' refers to cells that can't be interpreted"
|
552
|
+
end
|
553
|
+
end
|
554
|
+
end
|
555
|
+
else
|
556
|
+
log.warn "Named reference '#{name}' refers to cells that can't be interpreted"
|
557
|
+
end
|
558
|
+
end
|
559
|
+
end
|
528
560
|
required_refs
|
529
561
|
end
|
530
562
|
|
@@ -538,8 +570,9 @@ class ExcelToX
|
|
538
570
|
ref = @named_references[name]
|
539
571
|
if ref
|
540
572
|
add_ref_to_hash(ref, @cells_to_keep)
|
573
|
+
p @cells_to_keep
|
541
574
|
else
|
542
|
-
log.warn "Named reference "#{name}" not found"
|
575
|
+
log.warn "Named reference \"#{name}\" not found"
|
543
576
|
end
|
544
577
|
end
|
545
578
|
end
|
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.1
|
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: 2013-12-
|
11
|
+
date: 2013-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubypeg
|