greentable 0.9.5 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab7fc7fd46a84a628011ff51b74236e79ff0b955
4
- data.tar.gz: be5fed0b18e72f26045b59bbf71463c4ad592f57
3
+ metadata.gz: dfd49c2ae156aa0a4335574aba4a6315ede741ec
4
+ data.tar.gz: b35fd583be07e1eb3700495b8475e5a57b96cf75
5
5
  SHA512:
6
- metadata.gz: 5d9a8c4242e2f4a1c6f281f066b6d0677410fdaf4b12b59e4be82d2da9760080841ed06dcab9aceb58277afe2771138a10f3a315b0ac51c3d3a1d5b33cc698a7
7
- data.tar.gz: 67b6e500f29b6e2a5d682fb48cb1b2161d6d9728372007009936a71ffe732f3586f1b6644973e932ee33d3e517dc83e3fd96d5ec468e42b6bccf576881c8425b
6
+ metadata.gz: 10971a531679fadbbcbe7d5139e998a5163cb8e371b197ebc81961a719141d9c27047801d4f464f6ea77a3796f03bacbcf886e4100f81b78624b721b455d4f5b
7
+ data.tar.gz: 076534cbb4412afeb2e3614c4c46fc2d0b62e119fdfa6c645c5e2fa51ca077a0386d4bdc52f187a93598791644939399b36821f8a662c61960a4379a35b6efaf
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- greentable (0.9.5)
4
+ greentable (0.9.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -371,6 +371,8 @@ Add a couple of http query parameters in your view and your done:
371
371
  <% end %>
372
372
  ```
373
373
 
374
+ Green Export and Green Printing requires *Nokogiri* to be installed. Add 'nokogiri' as a gem dependency to your project if you want to use greentable's export or printing feature
375
+
374
376
  ### Available Query Parameters
375
377
 
376
378
  * **greentable_id**=*any string* [REQUIRED]. A unique html tag id to tell the rack middleware which greentable to extract.
@@ -119,6 +119,13 @@ module Greentable
119
119
 
120
120
  def do_attributes(i, o)
121
121
  row = i.nil? ? nil : @records[i]
122
+ o = if o.is_a?(Proc) && row
123
+ row.instance_eval(&o)
124
+ elsif o.is_a?(Proc) && row.nil?
125
+ nil
126
+ else
127
+ o
128
+ end
122
129
  return "" if o.nil? || o.empty?
123
130
  ret = o.map{|k,v| "#{k.is_a?(Proc) ? row.instance_eval(&k).to_s : k.to_s}=\"#{v.is_a?(Proc) ? row.instance_eval(&v).to_s : v.to_s}\""}.join(" ").strip
124
131
  ret = " " + ret unless ret.empty?
@@ -131,6 +138,7 @@ module Greentable
131
138
 
132
139
  def deep_merge!(source_hash, specialized_hash)
133
140
  #this code is originally from the gem hash-deep-merge, but has been modified slightly
141
+ return specialized_hash unless specialized_hash.is_a?(Hash)
134
142
  specialized_hash.each_pair do |rkey, rval|
135
143
  if source_hash.has_key?(rkey) then
136
144
  lval = source_hash[rkey]
@@ -1,3 +1,3 @@
1
1
  module Greentable
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.6"
3
3
  end
@@ -214,4 +214,15 @@ class GreentableTableTest < ActiveSupport::TestCase
214
214
  end
215
215
  end
216
216
  end
217
+
218
+ test "tr proc" do
219
+ gt = Greentable::Table.new(self, [0], {tr: Proc.new{{foo: 'bar'}}})
220
+ gt.process do |gt, x|
221
+ gt.col('col') do
222
+ x
223
+ end
224
+ end
225
+ assert_equal "<table><thead><tr><th>col</th></tr></thead><tbody><tr foo=\"bar\"><td>0</td></tr></tbody></table>", gt.to_s
226
+
227
+ end
217
228
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greentable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wael Chatila
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2015-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails