table_fu 0.3.2 → 0.3.3

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/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :major: 0
3
2
  :minor: 3
4
- :patch: 2
5
3
  :build:
4
+ :patch: 3
5
+ :major: 0
@@ -1,9 +1,10 @@
1
1
  <%
2
2
  $:.unshift File.expand_path(File.dirname(__FILE__), "/../lib/table_fu")
3
3
  require 'rubygems'
4
- require 'uv'
5
4
  require 'table_fu'
6
5
 
6
+ require 'uv'
7
+
7
8
  def code_for(file, output=true)
8
9
  return '' unless File.exists?("examples/#{file}.rb")
9
10
  file = File.open("examples/#{file}.rb").read
@@ -138,7 +139,12 @@ end %>
138
139
  <li><a href="doc/index.html">API Docs</a></li>
139
140
  </ul>
140
141
  <h2><a id="credits" href="#toc">Credits</a></h2>
141
- <p><a href="http://github.com/thejefflarson">Jeff Larson</a> (Maintainer), <a href="http://github.com/brianboyer/">Brian Boyer</a>, <a href="http://github.com/kleinmatic">Scott Klein</a>, <a href="http://github.com/markpercival">Mark Percival</a>, and <a href="http://github.com/seebq">Charles Brian Quinn</a>.</p>
142
+ <p><a href="http://github.com/thejefflarson">Jeff Larson</a> (Maintainer),
143
+ <a href="http://github.com/brianboyer/">Brian Boyer</a>,
144
+ <a href="http://github.com/kleinmatic">Scott Klein</a>,
145
+ <a href="http://github.com/markpercival">Mark Percival</a>,
146
+ <a href="http://github.com/seebq">Charles Brian Quinn</a>, and
147
+ <a href="http://github.com/jpmckinney">James McKinney</a>.</p>.</p>
142
148
  <h2><a id="license" href="#toc">License</a></h2>
143
149
  <pre><%= File.open("LICENSE").read %></pre>
144
150
  </body>
data/index.html CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  <body>
12
12
  <a href="http://www.propublica.org" class="propublica">&nbsp;</a>
13
- <h1>TableFu <small>&ndash; Version: 0.3.2</small></h1>
13
+ <h1>TableFu <small>&ndash; Version: 0.3.3</small></h1>
14
14
 
15
15
  <p><a href="http://github.com/propublica/table-fu">TableFu</a> is a ruby gem for spreadsheet-style handling of arrays (e.g. filtering, formatting, and sorting by "column" or "row"). In addition, it has the ability to <a href="#facet">facet</a> &mdash; or group &mdash; rows according to cell value. It was developed as a backend for its companion project <a href="http://www.github.com/propublica/table-setter">TableSetter</a>.</p>
16
16
  <p>For example, <strong>TableFu</strong> can consume a csv file and sort on a column:
@@ -169,7 +169,12 @@ spreadsheet<span class="PunctuationSeparator">.</span><span class="Entity">total
169
169
  <li><a href="doc/index.html">API Docs</a></li>
170
170
  </ul>
171
171
  <h2><a id="credits" href="#toc">Credits</a></h2>
172
- <p><a href="http://github.com/thejefflarson">Jeff Larson</a> (Maintainer), <a href="http://github.com/brianboyer/">Brian Boyer</a>, <a href="http://github.com/kleinmatic">Scott Klein</a>, <a href="http://github.com/markpercival">Mark Percival</a>, and <a href="http://github.com/seebq">Charles Brian Quinn</a>.</p>
172
+ <p><a href="http://github.com/thejefflarson">Jeff Larson</a> (Maintainer),
173
+ <a href="http://github.com/brianboyer/">Brian Boyer</a>,
174
+ <a href="http://github.com/kleinmatic">Scott Klein</a>,
175
+ <a href="http://github.com/markpercival">Mark Percival</a>,
176
+ <a href="http://github.com/seebq">Charles Brian Quinn</a>, and
177
+ <a href="http://github.com/jpmckinney">James McKinney</a>.</p>.</p>
173
178
  <h2><a id="license" href="#toc">License</a></h2>
174
179
  <pre>Copyright (c) 2010 ProPublica
175
180
 
@@ -38,7 +38,7 @@ class TableFu::Formatting
38
38
  end
39
39
 
40
40
  # Returns an error message if the given formatter isn't available
41
- def method_missing(method)
41
+ def method_missing(method, *args)
42
42
  "#{method.to_s} not a valid formatter!"
43
43
  end
44
44
 
data/lib/table_fu.rb CHANGED
@@ -281,7 +281,7 @@ class TableFu
281
281
  elsif @spreadsheet.formatting && format_method = @spreadsheet.formatting[column_name]
282
282
  TableFu::Formatting.send(format_method, @datum) || ''
283
283
  else
284
- @datum || ''
284
+ @datum.to_s || ''
285
285
  end
286
286
  ret.force_encoding("UTF-8") if RUBY_VERSION > "1.9"
287
287
  ret
@@ -58,6 +58,10 @@ describe TableFu do
58
58
  @spreadsheet.deleted_rows.length.should eql 5
59
59
  @spreadsheet.rows.length.should eql 2
60
60
  end
61
+
62
+ it 'should convert a total to a string' do
63
+ @spreadsheet.total_for('Projects').to_s.should eql '24'
64
+ end
61
65
  end
62
66
 
63
67
  describe TableFu, 'with a complicated setup' do
@@ -204,6 +208,11 @@ describe TableFu, 'with macro columns' do
204
208
  @spreadsheet.rows[1].column_for('Total Appropriation').to_s.should eql '$42,367,198'
205
209
  end
206
210
 
211
+ it "should not barf if we try a bad formatter" do
212
+ @spreadsheet.col_opts[:formatting] = {'Total Appropriation' => :bad_formatter }
213
+ @spreadsheet.rows[1].column_for('Total Appropriation').to_s.should eql "bad_formatter not a valid formatter!"
214
+ end
215
+
207
216
  end
208
217
 
209
218
  describe TableFu, 'with reordered columns' do
data/table_fu.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{table_fu}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark Percival", "Jeff Larson"]
12
- s.date = %q{2010-11-19}
12
+ s.date = %q{2011-02-19}
13
13
  s.description = %q{A library for manipulating tables as arrays}
14
14
  s.email = %q{jeff.larson@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_fu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mark Percival
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-19 00:00:00 -05:00
19
+ date: 2011-02-19 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency