data-table 1.0.0 → 1.0.1

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.
@@ -0,0 +1,28 @@
1
+ # DataTable
2
+
3
+ ## Credits
4
+ Nearly all of the code for this was written by @smerickson.
5
+
6
+ ## Install
7
+ ```ruby
8
+ gem install data-table
9
+ ```
10
+
11
+ or, in your Gemfile
12
+
13
+ ```ruby
14
+ gem 'data-table'
15
+ ```
16
+
17
+ ## Synopsis
18
+ ```ruby
19
+ records = [{:name => 'Matz', :language => 'Ruby'}, {:name => 'Ashkenas', :language => 'CoffeeScript'}, {:name => 'Guido', :language => 'Python'}]
20
+
21
+ DataTable.render(records) do |t|
22
+ t.id = 'language-table'
23
+ t.cssClass = 'table'
24
+
25
+ t.column :name, 'Creator Name'
26
+ t.column :language, 'Language'
27
+ end
28
+ ```
@@ -294,7 +294,7 @@ class DataTable
294
294
  def subtotal(column_name, function=nil, &b)
295
295
  function_or_block = function || b
296
296
  f = function && block_given? ? [function, b] : function_or_block
297
- @subtotals << {column_name => f}
297
+ @subtotals.merge!({column_name => f})
298
298
  end
299
299
 
300
300
  def has_subtotals?
@@ -311,7 +311,7 @@ class DataTable
311
311
  def total(column_name, function=nil, &b)
312
312
  function_or_block = function || b
313
313
  f = function && block_given? ? [function, b] : function_or_block
314
- @totals << {column_name => f}
314
+ @totals.merge!({column_name => f})
315
315
  end
316
316
 
317
317
  def has_totals?
@@ -1,3 +1,3 @@
1
1
  class DataTable
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data-table
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-09 00:00:00.000000000Z
13
+ date: 2011-10-26 00:00:00.000000000Z
14
14
  dependencies: []
15
15
  description: data-table is a simple gem that provides a DSL for allowing you do turn
16
16
  an array of hashes or ActiveRecord objects into an HTML table.
@@ -22,6 +22,7 @@ extra_rdoc_files: []
22
22
  files:
23
23
  - .gitignore
24
24
  - Gemfile
25
+ - README.md
25
26
  - Rakefile
26
27
  - data-table.gemspec
27
28
  - lib/data-table.rb