writeexcel 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47e11786c44acb989d0bdf6892093094dfdae8b1
4
- data.tar.gz: 4f099e9f6626d563f5892ad677ef5051596eddc2
3
+ metadata.gz: cebe8b5ad6954bc1738d77487b127646a56d64e7
4
+ data.tar.gz: 2a2f56b156a5509f8a4f2908da8add9882c1f3a6
5
5
  SHA512:
6
- metadata.gz: bc1795bd107484350cfa48dd1263b61f6280398051f158334992a669e359a98b4987bd7c226453853c7730132a19560fbda70592059d9363d9a8b4e2ce41b478
7
- data.tar.gz: 79a2399de75607e4f8f01db705aeee56be70af8088064d6259c217fdb999a6796769fb144443f1290cca8c829decb50e366ed413c775289d8fbaccf48e3d3743
6
+ metadata.gz: d4605d345ef34c4cd5dc42723e68fc81fd5c83d0abf8ae010b14a543dcb0ab1b43a5ecae351c912a49007766ab49c9feb4fb0fc2ac9fc09cf3c6b13b2ea39151
7
+ data.tar.gz: e288110b5d45e81b4b38a095d48189b6e87b1384552b9dc9b4d15bede0d72c64adead6ba2f0dab29bffdf9bde6e26bc55e7825769aa9cf05d93bde8f77d188f7
@@ -84,6 +84,9 @@ Example Code:
84
84
  * and ......
85
85
 
86
86
  == Recent Change
87
+ v1.0.4
88
+ * put formula parsers classes in a module to avoid namespace conflicts. (thanks Kevin)
89
+
87
90
  v1.0.3
88
91
  * Bug fix issue 29. bug in extern sheet reference.
89
92
 
@@ -269,7 +269,7 @@ a number and a formula to the first worksheet in an Excel workbook called ruby.x
269
269
 
270
270
  # Write a number and a formula using A1 notation
271
271
  worksheet.write('A3', 1.2345)
272
- worksheet.write('A4', '=SIN(PI/4)')
272
+ worksheet.write('A4', '=SIN(PI()/4)')
273
273
 
274
274
  workbook.close
275
275
  </pre>
@@ -885,7 +885,7 @@ name="write"
885
885
  worksheet.write(&#39;A10&#39;, &#39;internal:Sheet1!A1&#39; ) # write_url
886
886
  worksheet.write(&#39;A11&#39;, &#39;external:c:\foo.xls&#39; ) # write_url
887
887
  worksheet.write(&#39;A12&#39;, &#39;=A3 + 3*A4&#39; ) # write_formula
888
- worksheet.write(&#39;A13&#39;, &#39;=SIN(PI/4)&#39; ) # write_formula
888
+ worksheet.write(&#39;A13&#39;, &#39;=SIN(PI()/4)&#39; ) # write_formula
889
889
  worksheet.write(&#39;A14&#39;, array ) # write_row
890
890
  worksheet.write(&#39;A15&#39;, [array] ) # write_col
891
891
  </pre>
@@ -1279,7 +1279,7 @@ name="write_formula"
1279
1279
 
1280
1280
  <pre>
1281
1281
  worksheet.write_formula(0, 0, &#39;=B3 + B4&#39; )
1282
- worksheet.write_formula(1, 0, &#39;=SIN(PI/4)&#39;)
1282
+ worksheet.write_formula(1, 0, &#39;=SIN(PI()/4)&#39;)
1283
1283
  worksheet.write_formula(2, 0, &#39;=SUM(B1:B5)&#39; )
1284
1284
  worksheet.write_formula(&#39;A4&#39;, &#39;=IF(A3&#62;1,&#34;Yes&#34;, &#34;No&#34;)&#39; )
1285
1285
  worksheet.write_formula(&#39;A5&#39;, &#39;=AVERAGE(1, 2, 3, 4)&#39; )
@@ -5946,4 +5946,3 @@ name="COPYRIGHT"
5946
5946
  <!-- end doc -->
5947
5947
 
5948
5948
  </body></html>
5949
-
@@ -63,77 +63,80 @@ end
63
63
 
64
64
  class ExcelFormulaParserError < StandardError; end
65
65
 
66
- class Node
67
-
68
- def exec_list(nodes)
69
- v = nil
70
- nodes.each { |i| v = i.evaluate }
71
- v
72
- end
73
-
74
- def excelformulaparser_error(msg)
75
- raise ExcelFormulaParserError,
76
- "in #{fname}:#{lineno}: #{msg}"
77
- end
78
-
79
- end
80
-
81
- class RootNode < Node
82
-
83
- def initialize(tree)
84
- @tree = tree
85
- end
86
-
87
- def evaluate
88
- exec_list @tree
89
- end
90
-
91
- end
92
-
93
-
94
- class FuncallNode < Node
95
-
96
- def initialize(func, args)
97
- @func = func
98
- @args = args
99
- end
100
-
101
- def evaluate
102
- arg = @args.collect {|i| i.evaluate }
103
- out = []
104
- arg.each { |i| o.push i }
105
- o.push @func
106
- p o
66
+ module Writeexcel
67
+
68
+ class Node
69
+
70
+ def exec_list(nodes)
71
+ v = nil
72
+ nodes.each { |i| v = i.evaluate }
73
+ v
74
+ end
75
+
76
+ def excelformulaparser_error(msg)
77
+ raise ExcelFormulaParserError,
78
+ "in #{fname}:#{lineno}: #{msg}"
79
+ end
80
+
107
81
  end
108
-
109
- end
110
-
111
- class NumberNode < Node
112
-
113
- def initialize(val)
114
- @val = val
82
+
83
+ class RootNode < Node
84
+
85
+ def initialize(tree)
86
+ @tree = tree
87
+ end
88
+
89
+ def evaluate
90
+ exec_list @tree
91
+ end
92
+
115
93
  end
116
-
117
- def evaluate
118
- p @val
94
+
95
+
96
+ class FuncallNode < Node
97
+
98
+ def initialize(func, args)
99
+ @func = func
100
+ @args = args
101
+ end
102
+
103
+ def evaluate
104
+ arg = @args.collect {|i| i.evaluate }
105
+ out = []
106
+ arg.each { |i| o.push i }
107
+ o.push @func
108
+ p o
109
+ end
110
+
119
111
  end
120
-
121
- end
122
-
123
- class OperateNode < Node
124
-
125
- def initialize(op, left, right)
126
- @op = op
127
- @left = left
128
- @right = right
112
+
113
+ class NumberNode < Node
114
+
115
+ def initialize(val)
116
+ @val = val
117
+ end
118
+
119
+ def evaluate
120
+ p @val
121
+ end
122
+
129
123
  end
130
-
131
- def evaluate
132
- o = []
133
- o.push @left
134
- o.push @right
135
- o.push @op
136
- p o
124
+
125
+ class OperateNode < Node
126
+
127
+ def initialize(op, left, right)
128
+ @op = op
129
+ @left = left
130
+ @right = right
131
+ end
132
+
133
+ def evaluate
134
+ o = []
135
+ o.push @left
136
+ o.push @right
137
+ o.push @op
138
+ p o
139
+ end
137
140
  end
138
141
  end
139
142
 
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # DO NOT MODIFY!!!!
4
- # This file is automatically generated by Racc 1.4.6
4
+ # This file is automatically generated by Racc 1.4.11
5
5
  # from Racc grammer file "".
6
6
  #
7
7
 
@@ -293,14 +293,14 @@ class ExcelFormulaParser < Racc::Parser # :nodoc:
293
293
 
294
294
  module_eval(<<'.,.,', 'excelformula.y', 20)
295
295
  def _reduce_2(val, _values, result)
296
- result = []
296
+ result = []
297
297
  result
298
298
  end
299
299
  .,.,
300
300
 
301
301
  module_eval(<<'.,.,', 'excelformula.y', 21)
302
302
  def _reduce_3(val, _values, result)
303
- result.push val[1], '_arg', '1'
303
+ result.push val[1], '_arg', '1'
304
304
  result
305
305
  end
306
306
  .,.,
@@ -309,84 +309,84 @@ def _reduce_3(val, _values, result)
309
309
 
310
310
  module_eval(<<'.,.,', 'excelformula.y', 24)
311
311
  def _reduce_5(val, _values, result)
312
- result = [ val[0], val[2], 'ptgAdd' ]
312
+ result = [ val[0], val[2], 'ptgAdd' ]
313
313
  result
314
314
  end
315
315
  .,.,
316
316
 
317
317
  module_eval(<<'.,.,', 'excelformula.y', 25)
318
318
  def _reduce_6(val, _values, result)
319
- result = [ val[0], val[2], 'ptgSub' ]
319
+ result = [ val[0], val[2], 'ptgSub' ]
320
320
  result
321
321
  end
322
322
  .,.,
323
323
 
324
324
  module_eval(<<'.,.,', 'excelformula.y', 26)
325
325
  def _reduce_7(val, _values, result)
326
- result = [ val[0], val[2], 'ptgMul' ]
326
+ result = [ val[0], val[2], 'ptgMul' ]
327
327
  result
328
328
  end
329
329
  .,.,
330
330
 
331
331
  module_eval(<<'.,.,', 'excelformula.y', 27)
332
332
  def _reduce_8(val, _values, result)
333
- result = [ val[0], val[2], 'ptgDiv' ]
333
+ result = [ val[0], val[2], 'ptgDiv' ]
334
334
  result
335
335
  end
336
336
  .,.,
337
337
 
338
338
  module_eval(<<'.,.,', 'excelformula.y', 28)
339
339
  def _reduce_9(val, _values, result)
340
- result = [ val[0], val[2], 'ptgPower' ]
340
+ result = [ val[0], val[2], 'ptgPower' ]
341
341
  result
342
342
  end
343
343
  .,.,
344
344
 
345
345
  module_eval(<<'.,.,', 'excelformula.y', 29)
346
346
  def _reduce_10(val, _values, result)
347
- result = [ val[0], val[2], 'ptgConcat' ]
347
+ result = [ val[0], val[2], 'ptgConcat' ]
348
348
  result
349
349
  end
350
350
  .,.,
351
351
 
352
352
  module_eval(<<'.,.,', 'excelformula.y', 30)
353
353
  def _reduce_11(val, _values, result)
354
- result = [ val[0], val[2], 'ptgLT' ]
354
+ result = [ val[0], val[2], 'ptgLT' ]
355
355
  result
356
356
  end
357
357
  .,.,
358
358
 
359
359
  module_eval(<<'.,.,', 'excelformula.y', 31)
360
360
  def _reduce_12(val, _values, result)
361
- result = [ val[0], val[2], 'ptgGT' ]
361
+ result = [ val[0], val[2], 'ptgGT' ]
362
362
  result
363
363
  end
364
364
  .,.,
365
365
 
366
366
  module_eval(<<'.,.,', 'excelformula.y', 32)
367
367
  def _reduce_13(val, _values, result)
368
- result = [ val[0], val[2], 'ptgLE' ]
368
+ result = [ val[0], val[2], 'ptgLE' ]
369
369
  result
370
370
  end
371
371
  .,.,
372
372
 
373
373
  module_eval(<<'.,.,', 'excelformula.y', 33)
374
374
  def _reduce_14(val, _values, result)
375
- result = [ val[0], val[2], 'ptgGE' ]
375
+ result = [ val[0], val[2], 'ptgGE' ]
376
376
  result
377
377
  end
378
378
  .,.,
379
379
 
380
380
  module_eval(<<'.,.,', 'excelformula.y', 34)
381
381
  def _reduce_15(val, _values, result)
382
- result = [ val[0], val[2], 'ptgNE' ]
382
+ result = [ val[0], val[2], 'ptgNE' ]
383
383
  result
384
384
  end
385
385
  .,.,
386
386
 
387
387
  module_eval(<<'.,.,', 'excelformula.y', 35)
388
388
  def _reduce_16(val, _values, result)
389
- result = [ val[0], val[2], 'ptgEQ' ]
389
+ result = [ val[0], val[2], 'ptgEQ' ]
390
390
  result
391
391
  end
392
392
  .,.,
@@ -395,14 +395,14 @@ def _reduce_16(val, _values, result)
395
395
 
396
396
  module_eval(<<'.,.,', 'excelformula.y', 38)
397
397
  def _reduce_18(val, _values, result)
398
- result = [ val[1], '_arg', '1', 'ptgParen']
398
+ result = [ val[1], '_arg', '1', 'ptgParen']
399
399
  result
400
400
  end
401
401
  .,.,
402
402
 
403
403
  module_eval(<<'.,.,', 'excelformula.y', 39)
404
404
  def _reduce_19(val, _values, result)
405
- result = [ '_num', '-1', val[1], 'ptgMul' ]
405
+ result = [ '_num', '-1', val[1], 'ptgMul' ]
406
406
  result
407
407
  end
408
408
  .,.,
@@ -411,63 +411,63 @@ def _reduce_19(val, _values, result)
411
411
 
412
412
  module_eval(<<'.,.,', 'excelformula.y', 41)
413
413
  def _reduce_21(val, _values, result)
414
- result = [ '_num', val[0] ]
414
+ result = [ '_num', val[0] ]
415
415
  result
416
416
  end
417
417
  .,.,
418
418
 
419
419
  module_eval(<<'.,.,', 'excelformula.y', 42)
420
420
  def _reduce_22(val, _values, result)
421
- result = [ '_str', val[0] ]
421
+ result = [ '_str', val[0] ]
422
422
  result
423
423
  end
424
424
  .,.,
425
425
 
426
426
  module_eval(<<'.,.,', 'excelformula.y', 43)
427
427
  def _reduce_23(val, _values, result)
428
- result = [ '_ref2d', val[0] ]
428
+ result = [ '_ref2d', val[0] ]
429
429
  result
430
430
  end
431
431
  .,.,
432
432
 
433
433
  module_eval(<<'.,.,', 'excelformula.y', 44)
434
434
  def _reduce_24(val, _values, result)
435
- result = [ '_ref3d', val[0] ]
435
+ result = [ '_ref3d', val[0] ]
436
436
  result
437
437
  end
438
438
  .,.,
439
439
 
440
440
  module_eval(<<'.,.,', 'excelformula.y', 45)
441
441
  def _reduce_25(val, _values, result)
442
- result = [ '_range2d', val[0] ]
442
+ result = [ '_range2d', val[0] ]
443
443
  result
444
444
  end
445
445
  .,.,
446
446
 
447
447
  module_eval(<<'.,.,', 'excelformula.y', 46)
448
448
  def _reduce_26(val, _values, result)
449
- result = [ '_range3d', val[0] ]
449
+ result = [ '_range3d', val[0] ]
450
450
  result
451
451
  end
452
452
  .,.,
453
453
 
454
454
  module_eval(<<'.,.,', 'excelformula.y', 47)
455
455
  def _reduce_27(val, _values, result)
456
- result = [ '_name', val[0] ]
456
+ result = [ '_name', val[0] ]
457
457
  result
458
458
  end
459
459
  .,.,
460
460
 
461
461
  module_eval(<<'.,.,', 'excelformula.y', 48)
462
462
  def _reduce_28(val, _values, result)
463
- result = [ 'ptgBool', '1' ]
463
+ result = [ 'ptgBool', '1' ]
464
464
  result
465
465
  end
466
466
  .,.,
467
467
 
468
468
  module_eval(<<'.,.,', 'excelformula.y', 49)
469
469
  def _reduce_29(val, _values, result)
470
- result = [ 'ptgBool', '0' ]
470
+ result = [ 'ptgBool', '0' ]
471
471
  result
472
472
  end
473
473
  .,.,
@@ -476,112 +476,115 @@ def _reduce_29(val, _values, result)
476
476
 
477
477
  module_eval(<<'.,.,', 'excelformula.y', 52)
478
478
  def _reduce_31(val, _values, result)
479
- result = [ '_class', val[0], val[2], '_arg', val[2].size.to_s, '_func', val[0] ]
479
+ result = [ '_class', val[0], val[2], '_arg', val[2].size.to_s, '_func', val[0] ]
480
480
  result
481
481
  end
482
482
  .,.,
483
483
 
484
484
  module_eval(<<'.,.,', 'excelformula.y', 53)
485
485
  def _reduce_32(val, _values, result)
486
- result = [ '_func', val[0] ]
486
+ result = [ '_func', val[0] ]
487
487
  result
488
488
  end
489
489
  .,.,
490
490
 
491
491
  module_eval(<<'.,.,', 'excelformula.y', 55)
492
492
  def _reduce_33(val, _values, result)
493
- result = val
493
+ result = val
494
494
  result
495
495
  end
496
496
  .,.,
497
497
 
498
498
  module_eval(<<'.,.,', 'excelformula.y', 56)
499
499
  def _reduce_34(val, _values, result)
500
- result.push val[2]
500
+ result.push val[2]
501
501
  result
502
502
  end
503
503
  .,.,
504
504
 
505
- def _reduce_none(val, _values, result)
506
- val[0]
507
- end
508
-
509
- end # class ExcelFormulaParser
510
-
511
-
512
- class ExcelFormulaParserError < StandardError #:nodoc:
505
+ def _reduce_none(val, _values, result)
506
+ val[0]
513
507
  end
514
508
 
515
- class Node # :nodoc:
516
-
517
- def exec_list(nodes)
518
- v = nil
519
- nodes.each { |i| v = i.evaluate }
520
- v
521
- end
522
-
523
- def excelformulaparser_error(msg)
524
- raise ExcelFormulaParserError,
525
- "in #{fname}:#{lineno}: #{msg}"
526
- end
527
-
528
- end
529
-
530
- class RootNode < Node # :nodoc:
531
-
532
- def initialize(tree)
533
- @tree = tree
534
- end
509
+ end # class ExcelFormulaParser
535
510
 
536
- def evaluate
537
- exec_list @tree
538
- end
539
511
 
512
+ class ExcelFormulaParserError < StandardError #:nodoc:
540
513
  end
541
514
 
542
-
543
- class FuncallNode < Node # :nodoc:
544
-
545
- def initialize(func, args)
546
- @func = func
547
- @args = args
515
+ module Writeexcel
516
+
517
+ class Node # :nodoc:
518
+
519
+ def exec_list(nodes)
520
+ v = nil
521
+ nodes.each { |i| v = i.evaluate }
522
+ v
523
+ end
524
+
525
+ def excelformulaparser_error(msg)
526
+ raise ExcelFormulaParserError,
527
+ "in #{fname}:#{lineno}: #{msg}"
528
+ end
529
+
548
530
  end
549
-
550
- def evaluate
551
- arg = @args.collect {|i| i.evaluate }
552
- out = []
553
- arg.each { |i| o.push i }
554
- o.push @func
555
- p o
531
+
532
+ class RootNode < Node # :nodoc:
533
+
534
+ def initialize(tree)
535
+ @tree = tree
536
+ end
537
+
538
+ def evaluate
539
+ exec_list @tree
540
+ end
541
+
556
542
  end
557
-
558
- end
559
-
560
- class NumberNode < Node # :nodoc:
561
-
562
- def initialize(val)
563
- @val = val
543
+
544
+
545
+ class FuncallNode < Node # :nodoc:
546
+
547
+ def initialize(func, args)
548
+ @func = func
549
+ @args = args
550
+ end
551
+
552
+ def evaluate
553
+ arg = @args.collect {|i| i.evaluate }
554
+ out = []
555
+ arg.each { |i| o.push i }
556
+ o.push @func
557
+ p o
558
+ end
559
+
564
560
  end
565
-
566
- def evaluate
567
- p @val
561
+
562
+ class NumberNode < Node # :nodoc:
563
+
564
+ def initialize(val)
565
+ @val = val
566
+ end
567
+
568
+ def evaluate
569
+ p @val
570
+ end
571
+
568
572
  end
569
-
570
- end
571
-
572
- class OperateNode < Node # :nodoc:
573
-
574
- def initialize(op, left, right)
575
- @op = op
576
- @left = left
577
- @right = right
578
- end
579
-
580
- def evaluate
581
- o = []
582
- o.push @left
583
- o.push @right
584
- o.push @op
585
- p o
573
+
574
+ class OperateNode < Node # :nodoc:
575
+
576
+ def initialize(op, left, right)
577
+ @op = op
578
+ @left = left
579
+ @right = right
580
+ end
581
+
582
+ def evaluate
583
+ o = []
584
+ o.push @left
585
+ o.push @right
586
+ o.push @op
587
+ p o
588
+ end
586
589
  end
587
590
  end
@@ -1,5 +1,5 @@
1
1
  require 'writeexcel'
2
2
 
3
3
  class WriteExcel < Workbook
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: writeexcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hideo NAKAMURA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-13 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description: Multiple worksheets can be added to a workbook and formatting can be
@@ -35,9 +35,9 @@ extra_rdoc_files:
35
35
  - LICENSE.txt
36
36
  - README.rdoc
37
37
  files:
38
- - .document
39
- - .gitattributes
40
- - .gitignore
38
+ - ".document"
39
+ - ".gitattributes"
40
+ - ".gitignore"
41
41
  - Gemfile
42
42
  - LICENSE.txt
43
43
  - README.rdoc
@@ -304,17 +304,17 @@ require_paths:
304
304
  - lib
305
305
  required_ruby_version: !ruby/object:Gem::Requirement
306
306
  requirements:
307
- - - '>='
307
+ - - ">="
308
308
  - !ruby/object:Gem::Version
309
309
  version: '0'
310
310
  required_rubygems_version: !ruby/object:Gem::Requirement
311
311
  requirements:
312
- - - '>='
312
+ - - ">="
313
313
  - !ruby/object:Gem::Version
314
314
  version: '0'
315
315
  requirements: []
316
316
  rubyforge_project:
317
- rubygems_version: 2.1.11
317
+ rubygems_version: 2.2.0
318
318
  signing_key:
319
319
  specification_version: 4
320
320
  summary: Write to a cross-platform Excel binary file.