table_print 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/table_print/fingerprinter.rb +3 -1
- data/lib/table_print/version.rb +1 -1
- data/spec/fingerprinter_spec.rb +9 -0
- metadata +2 -2
@@ -40,8 +40,10 @@ module TablePrint
|
|
40
40
|
cell_value = target[method.to_sym]
|
41
41
|
elsif target.is_a? Hash and target.keys.include? method
|
42
42
|
cell_value = target[method]
|
43
|
-
|
43
|
+
elsif target.respond_to? method
|
44
44
|
cell_value ||= target.send(method)
|
45
|
+
else
|
46
|
+
cell_value = "Method Missing"
|
45
47
|
end
|
46
48
|
cells[@column_names_by_display_method[display_method]] = cell_value
|
47
49
|
end
|
data/lib/table_print/version.rb
CHANGED
data/spec/fingerprinter_spec.rb
CHANGED
@@ -130,6 +130,15 @@ describe Fingerprinter do
|
|
130
130
|
row.cells.should == {'title' => 'foobar', 'author' => 'bobby'}
|
131
131
|
end
|
132
132
|
end
|
133
|
+
|
134
|
+
context "when the method isn't found" do
|
135
|
+
it "sets the cell value to an error string" do
|
136
|
+
f = Fingerprinter.new
|
137
|
+
f.instance_variable_set('@column_names_by_display_method', {'foo' => 'foo'})
|
138
|
+
row = f.populate_row('', {'foo' => {}}, Hash.new)
|
139
|
+
row.cells.should == {'foo' => 'Method Missing'}
|
140
|
+
end
|
141
|
+
end
|
133
142
|
end
|
134
143
|
|
135
144
|
describe "#create_child_group" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_print
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
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-
|
12
|
+
date: 2013-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cat
|