table_cloth 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 749bf677a3ffe591ab0f3a1a61ca5f016d7f91bd
4
- data.tar.gz: d103710bf95ca76c6ea6eaadbf6b99a438aa5a0d
3
+ metadata.gz: c65717cdebdb8f49b10674b75af93e3cd71c8945
4
+ data.tar.gz: bd39e2f924ee24b1c15e0c8e630a272d6421777b
5
5
  SHA512:
6
- metadata.gz: 2c17f9cc988b73d71b911caa21c33f9a77397c5020c4150b3453ce00a887af9456bfa74d05c1617cebe3ced9311156e5eb189df17ed5116e759df48f982abce7
7
- data.tar.gz: 91c0569d11104abef8adc608d7e6cbc0ce654ddddc6cd9938178c640cf1ba36ea8242028cfffe0c1b7ea21a570d55a458b164f4db417df06a546a37fe5ace362
6
+ metadata.gz: d3a70578873d04a792e101ad3e0c1616130ad5fe02ddf7002326c7b5aa257771b408c477603b600deda630099c51e79b139738e4b5646b0704327b9313b90a37
7
+ data.tar.gz: 150e1d3e2545e159f90f4852447caa4d14c22120b3c0d252ea77be1ef4876e4f618693dea9a66697ce83ac95f730835be65bf55a059cdd6899237294edd02658
@@ -41,7 +41,7 @@ module TableCloth
41
41
  end
42
42
 
43
43
  def column_for_object(column, object)
44
- td_options = column.options[:td_options] || {}
44
+ td_options = column.options[:td_options].try(:dup) || {}
45
45
  value = column.value(object, view_context, table)
46
46
 
47
47
  if value.is_a?(Array)
@@ -1,3 +1,3 @@
1
1
  module TableCloth
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -66,5 +66,20 @@ describe TableCloth::Presenters::Default do
66
66
  end
67
67
  end
68
68
  end
69
+
70
+ context 'html_safe cell content with td_options' do
71
+ let(:objects) do
72
+ list = FactoryGirl.build_list(:dummy_model, 3, :name => nil)
73
+ list.first.name = 'robert'
74
+ list
75
+ end
76
+ let(:dummy_table) { Class.new(DummyTableWithHTMLSafe) }
77
+
78
+ it 'only outputs html_safe content in the correct column' do
79
+ tbody = Nokogiri::HTML(subject.tbody.to_s).at_xpath('//tbody')
80
+
81
+ expect( tbody.xpath('//td').map(&:content) ).to eq ['robert', '', '']
82
+ end
83
+ end
69
84
  end
70
85
  end
@@ -0,0 +1,5 @@
1
+ class DummyTableWithHTMLSafe < TableCloth::Base
2
+ column :name, td_options: { class: 'irrelevant' } do |object|
3
+ object.name.html_safe if object.name
4
+ end
5
+ end
metadata CHANGED
@@ -1,173 +1,173 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_cloth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Ross
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.11'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: simplecov
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: awesome_print
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: factory_girl
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: guard-rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rb-fsevent
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.9.4
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.9.4
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: actionpack
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '3.1'
146
- - - "<"
146
+ - - <
147
147
  - !ruby/object:Gem::Version
148
148
  version: '4.2'
149
149
  type: :runtime
150
150
  prerelease: false
151
151
  version_requirements: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ">="
153
+ - - '>='
154
154
  - !ruby/object:Gem::Version
155
155
  version: '3.1'
156
- - - "<"
156
+ - - <
157
157
  - !ruby/object:Gem::Version
158
158
  version: '4.2'
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: element_factory
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - "~>"
163
+ - - ~>
164
164
  - !ruby/object:Gem::Version
165
165
  version: 0.1.2
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
- - - "~>"
170
+ - - ~>
171
171
  - !ruby/object:Gem::Version
172
172
  version: 0.1.2
173
173
  description: Table Cloth helps you create tables easily.
@@ -177,9 +177,9 @@ executables: []
177
177
  extensions: []
178
178
  extra_rdoc_files: []
179
179
  files:
180
- - ".gitignore"
181
- - ".rspec"
182
- - ".travis.yml"
180
+ - .gitignore
181
+ - .rspec
182
+ - .travis.yml
183
183
  - CHANGELOG
184
184
  - Gemfile
185
185
  - Guardfile
@@ -223,6 +223,7 @@ files:
223
223
  - spec/spec_helper.rb
224
224
  - spec/support/dummy_model.rb
225
225
  - spec/support/dummy_table.rb
226
+ - spec/support/dummy_table_with_html_safe.rb
226
227
  - spec/support/dummy_table_with_value_options.rb
227
228
  - spec/support/element_helpers.rb
228
229
  - spec/support/matchers/element_matchers.rb
@@ -238,12 +239,12 @@ require_paths:
238
239
  - lib
239
240
  required_ruby_version: !ruby/object:Gem::Requirement
240
241
  requirements:
241
- - - ">="
242
+ - - '>='
242
243
  - !ruby/object:Gem::Version
243
244
  version: '0'
244
245
  required_rubygems_version: !ruby/object:Gem::Requirement
245
246
  requirements:
246
- - - ">="
247
+ - - '>='
247
248
  - !ruby/object:Gem::Version
248
249
  version: '0'
249
250
  requirements: []
@@ -274,6 +275,7 @@ test_files:
274
275
  - spec/spec_helper.rb
275
276
  - spec/support/dummy_model.rb
276
277
  - spec/support/dummy_table.rb
278
+ - spec/support/dummy_table_with_html_safe.rb
277
279
  - spec/support/dummy_table_with_value_options.rb
278
280
  - spec/support/element_helpers.rb
279
281
  - spec/support/matchers/element_matchers.rb