greentable 0.0.3 → 0.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.
data/greentable.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "greentable"
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
  s.author = "Wael Chatila"
5
5
  s.homepage = "https://github.com/waelchatila/greentable"
6
6
  s.summary = "Rails declarative html tables with export features"
@@ -21,13 +21,13 @@ module Greentable
21
21
 
22
22
  end
23
23
 
24
- def greensubrow(opts = {}, &block)
24
+ def subrow(opts = {}, &block)
25
25
  return if capture_headers
26
26
  return if opts[:display_on] == :first && !@row_counter.first?
27
27
  return if opts[:display_on] == :last && !@row_counter.last?
28
28
  end
29
29
 
30
- def greencolumn(th = nil, opts = {}, &block)
30
+ def col(th = nil, opts = {}, &block)
31
31
  @th_html[@current_col] = th
32
32
 
33
33
  @td_html[@row_counter.i] ||= []
@@ -51,13 +51,15 @@ module Greentable
51
51
  def to_s
52
52
  ret = ""
53
53
  ret << "<table#{do_attributes(@opts)}>"
54
- ret << "<thead>"
55
- ret << "<tr>"
56
- @th_html.each do |th|
57
- ret << "<th#{do_attributes(@opts_th)}>#{th}</th>"
54
+ unless @th_html.compact.empty?
55
+ ret << "<thead>"
56
+ ret << "<tr>"
57
+ @th_html.each do |th|
58
+ ret << "<th#{do_attributes(@opts_th)}>#{th.is_a?(Proc) ? th.call.to_s : th}</th>"
59
+ end
60
+ ret << "</tr>"
61
+ ret << "</thead>"
58
62
  end
59
- ret << "</tr>"
60
- ret << "</thead>"
61
63
  ret << "<tbody>"
62
64
 
63
65
  @row_counter.i.times do |i|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greentable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-12 00:00:00.000000000 Z
12
+ date: 2013-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake