spreadshoot 0.0.5 → 0.0.6

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.
data/examples/basic.rb CHANGED
@@ -119,6 +119,28 @@ spreadsheet = Spreadshoot.new do |s|
119
119
  end
120
120
  end
121
121
  end
122
+
123
+ s.worksheet('Cell formats') do |w|
124
+ w.table do |t|
125
+ t.row do |r|
126
+ r.cell 'No formatting'
127
+ r.cell 0.345
128
+ end
129
+ t.row do |r|
130
+ r.cell 'Percent'
131
+ r.cell 0.345, :format => :percent
132
+ end
133
+ t.row do |r|
134
+ r.cell 'Rounded percent'
135
+ r.cell 0.345, :format => :percent_rounded
136
+ end
137
+ t.row do |r|
138
+ r.cell 'Currency'
139
+ r.cell 0.345, :format => :currency
140
+ end
141
+ t.row 'Shorthand for', 'multiple cells'
142
+ end
143
+ end
122
144
  end
123
145
 
124
146
  spreadsheet.dump
data/lib/spreadshoot.rb CHANGED
@@ -62,8 +62,16 @@ class Spreadshoot
62
62
  14
63
63
  when :percent
64
64
  10
65
+ when :percent_rounded
66
+ 9
65
67
  when :currency
66
68
  7
69
+ when :thousands_separated_decimals
70
+ 4
71
+ when :thousands_separated
72
+ 3
73
+ when :two_decimals
74
+ 2
67
75
  else
68
76
  value
69
77
  end
@@ -118,10 +126,12 @@ class Spreadshoot
118
126
  end
119
127
 
120
128
  filename = File.absolute_path(filename)
129
+ current_dir = FileUtils.pwd
121
130
  FileUtils.chdir(dir)
122
131
  File.delete(filename) if File.exists?(filename)
123
132
  # zip the result
124
133
  puts `zip -r #{filename} ./`
134
+ FileUtils.chdir(current_dir)
125
135
  FileUtils.rm_rf(dir)
126
136
  end
127
137
 
@@ -451,8 +461,12 @@ class Spreadshoot
451
461
  @row_index = val
452
462
  end
453
463
 
454
- def row options = {}
464
+ def row *args
465
+ options = args.last.is_a?(Hash) ? args.pop : {}
455
466
  row = Row.new(self, options)
467
+ args.each do |cell_val|
468
+ row.cell(cell_val, options)
469
+ end
456
470
  yield(row) if block_given?
457
471
 
458
472
  if @direction == :vertical
@@ -1,3 +1,3 @@
1
1
  class Spreadshoot
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mladen Jablanovic
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-01-25 00:00:00 +01:00
17
+ date: 2013-08-08 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency