table_fu 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :major: 0
2
3
  :minor: 3
3
- :patch: 1
4
+ :patch: 2
4
5
  :build:
5
- :major: 0
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.1</small></h1>
13
+ <h1>TableFu <small>&ndash; Version: 0.3.2</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:
data/lib/table_fu.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  if RUBY_VERSION > "1.9"
2
2
  require 'csv'
3
- ::FasterCSV = CSV
3
+ Encoding.default_external = Encoding::UTF_8
4
+ Encoding.default_internal = Encoding::UTF_8
5
+ ::FasterCSV = CSV unless defined? FasterCSV
4
6
  else
5
7
  require 'fastercsv'
6
8
  end
@@ -274,13 +276,15 @@ class TableFu
274
276
  # And finally we return a empty string object or the value.
275
277
  #
276
278
  def to_s
277
- if macro_value
278
- macro_value
279
- elsif @spreadsheet.formatting && format_method = @spreadsheet.formatting[column_name]
280
- TableFu::Formatting.send(format_method, @datum) || ''
281
- else
282
- @datum || ''
283
- end
279
+ ret = if macro_value
280
+ macro_value
281
+ elsif @spreadsheet.formatting && format_method = @spreadsheet.formatting[column_name]
282
+ TableFu::Formatting.send(format_method, @datum) || ''
283
+ else
284
+ @datum || ''
285
+ end
286
+ ret.force_encoding("UTF-8") if RUBY_VERSION > "1.9"
287
+ ret
284
288
  end
285
289
 
286
290
  # Returns the macro'd format if there is one
data/table_fu.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{table_fu}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
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"]
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: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mark Percival